Git Product home page Git Product logo

mobile-ai-bench's Introduction

Mobile AI Bench

License pipeline status

FAQ | 中文

In recent years, the on-device deep learning applications are getting more and more popular on mobile phones or IoT devices. It's a challenging task for the developers to deploy their deep learning models in their mobile applications or IoT devices.

They need to optionally choose a cost-effective hardware solution (i.e. chips and boards), then a proper inference framework, optionally utilizing quantization or compression techniques regarding the precision-performance trade-off, and finally run the model on one or more of heterogeneous computing devices. How to make an appropriate decision among these choices is a tedious and time-consuming task.

Mobile AI Benchmark (i.e. MobileAIBench) is an end-to-end benchmark tool which covers different chips and inference frameworks, with results include both speed and model accuracy, which will give insights for developers.

Daily Benchmark Results

Please check benchmark step in daily CI pipeline page, due to the lack of test devices, the CI result may not cover all hardwares and frameworks.

FAQ

Q: Why are benchmark results not stable on my device?

A: Due to power save considerations, some SoCs have aggressive and advanced power control scheduling to reduce power consumption which make performance quite unstable (especially CPU). Benchmark results highly depend on states of devices, e.g., running processes, temperature, power control policy. It is recommended to disable power control policy (as shown in tools/power.sh) if possible (e.g., rooted phone). Otherwise, keep your device at idle state with low temperature, and benchmark one model on one framework each time.

Q: Why do some devices run faster (or slower) than expected in the CI benchmark result?

A: Some devices is rooted and has some specialized performance tuning while some others is not rooted and failed to make such tuning (see the code for more details).

Q: Why is ncnn initialization time much less than others?

A: ncnn benchmark uses fake model parameters and skips loading weights from filesystem.

Q: Does benchmark use all available cores of devices?

A: Most modern Android phones use ARM big.LITTLE architecture which can lead to significant variance between different runs of the benchmark, we use only available big cores to reduce this variance by taskset command for MACE/NCNN/TFLITE benchmark. Moreover, there are no well-defined APIs for SNPE to bind to big cores and set thread count. Thread count can be set by adding --num_threads to tools/benchmark.sh command.

Environment requirement

MobileAIBench supports several deep learning frameworks (called executor in this project, i.e., MACE, SNPE, ncnn, TensorFlow Lite and HIAI) currently, which may require the following dependencies:

Software Installation command Tested version
Python 2.7
ADB apt-get install android-tools-adb Required by Android run, >= 1.0.32
Android NDK NDK installation guide Required by Android build, r15c
Bazel bazel installation guide 0.13.0
CMake apt-get install cmake >= 3.11.3
FileLock pip install -I filelock==3.0.0 Required by Android run
PyYaml pip install -I pyyaml==3.12 3.12.0
sh pip install -I sh==1.12.14 1.12.14
SNPE (optional) download and uncompress 1.18.0

Note 1: SNPE has strict license that disallows redistribution, so the default link in the Bazel WORKSPACE file is only accessible by the CI server. To benchmark SNPE in your local system (i.e. set --executors with all or SNPE explicitly), you need to download the SDK here, uncompress it, copy libgnustl_shared.so and modify WORKSPACE as the following:

#new_http_archive(
#    name = "snpe",
#    build_file = "third_party/snpe/snpe.BUILD",
#    sha256 = "8f2b92b236aa7492e4acd217a96259b0ddc1a656cbc3201c7d1c843e1f957e77",
#    strip_prefix = "snpe-1.22.2.233",
#    urls = [
#        "https://cnbj1-fds.api.xiaomi.net/aibench/third_party/snpe-1.22.2_with_libgnustl_shared.so.zip",
#    ],
#)

new_local_repository(
    name = "snpe",
    build_file = "third_party/snpe/snpe.BUILD",
    path = "/path/to/snpe",
)

Note 2: HIAI has strict license that disallows redistribution, so the default link in the Bazel WORKSPACE file is only accessible by the CI server. To benchmark HIAI in your local system (i.e. set --executors with all or HIAI explicitly), you need to login and download the SDK here, uncompress it and get the HiAI_DDK_100.200.010.011.zip file, uncompress it and modify WORKSPACE as the following:

#new_http_archive(
#    name = "hiai",
#    build_file = "third_party/hiai/hiai.BUILD",
#    sha256 = "8da8305617573bc495df8f4509fcb1655ffb073d790d9c0b6ca32ba4a4e41055",
#    strip_prefix = "HiAI_DDK_100.200.010.011",
#    type = "zip",
#    urls = [
#        "http://cnbj1.fds.api.xiaomi.com/aibench/third_party/HiAI_DDK_100.200.010.011_LITE.zip",
#    ],
#)

new_local_repository(
    name = "hiai",
    build_file = "third_party/hiai/hiai.BUILD",
    path = "/path/to/hiai",
)

Architecture

+-----------------+         +------------------+      +---------------+
|   Benchmark     |         |   BaseExecutor   | <--- | MaceExecutor  |
+-----------------+         +------------------+      +---------------+
| - executor      |-------> | - executor       |
| - model_name    |         | - device_type    |      +---------------+
| - quantize      |         |                  | <--- | SnpeExecutor  |
| - input_names   |         +------------------+      +---------------+
| - input_shapes  |         | + Init()         |
| - output_names  |         | + Prepare()      |      +---------------+
| - output_shapes |         | + Run()          | <--- | NcnnExecutor  |
| - run_interval  |         | + Finish()       |      +---------------+
| - num_threads   |         |                  |
+-----------------+         |                  |      +---------------+
| - Run()         |         |                  | <--- | TfLiteExecutor|
+-----------------+         |                  |      +---------------+
        ^     ^             |                  |
        |     |             |                  |      +---------------+
        |     |             |                  | <--- | HiaiExecutor  |
        |     |             +------------------+      +---------------+
        |     |
        |     |             +--------------------+
        |     |             |PerformanceBenchmark|
        |     --------------+--------------------+
        |                   | - Run()            |
        |                   +--------------------+
        |
        |                   +---------------+      +---------------------+                           
+--------------------+ ---> |PreProcessor   | <--- |ImageNetPreProcessor |
| PrecisionBenchmark |      +---------------+      +---------------------+
+--------------------+
| - pre_processor    |      +---------------+      +---------------------+
| - post_processor   | ---> |PostProcessor  | <--- |ImageNetPostProcessor|
| - metric_evaluator |      +---------------+      +---------------------+
+--------------------+
| - Run()            |      +---------------+
+--------------------+ ---> |MetricEvaluator|
                            +---------------+

How To Use

Benchmark Performance of all models on all executors

bash tools/benchmark.sh --benchmark_option=Performance \
                        --target_abis=armeabi-v7a,arm64-v8a,aarch64,armhf

The whole benchmark may take a few time, and continuous benchmarking may heat the device very quickly, so you may set the following arguments according to your interests. Only MACE supports precision benchmark right now.

option type default explanation
--benchmark_option str Performance Benchmark options, Performance/Precision.
--output_dir str output Benchmark output directory.
--executors str all Executors(MACE/SNPE/NCNN/TFLITE/HIAI), comma separated list or all.
--device_types str all DeviceTypes(CPU/GPU/DSP/NPU), comma separated list or all.
--target_abis str armeabi-v7a Target ABIs(armeabi-v7a,arm64-v8a,aarch64,armhf), comma separated list.
--model_names str all Model names(InceptionV3,MobileNetV1...), comma separated list or all.
--run_interval int 10 Run interval between benchmarks, seconds.
--num_threads int 4 The number of threads.
--input_dir str "" Input data directory for precision benchmark.

Configure ssh devices

For embedded ARM-Linux devices whose abi is aarch64 or armhf, ssh connection is supported. Configure ssh devices in generic-mobile-devices/devices_for_ai_bench.yml, for example:

devices:
  nanopi:
    target_abis: [aarch64, armhf]
    target_socs: RK3333
    models: Nanopi M4
    address: 10.231.46.118
    username: pi

Adding a model to run on existing executor

  • Add the new model name in aibench/proto/base.proto if not in there.

  • Configure the model info in aibench/proto/model.meta.

  • Configure the benchmark info in aibench/proto/benchmark.meta.

  • Run benchmark

    Performance benchmark.

    bash tools/benchmark.sh --benchmark_option=Performance \
                            --executors=MACE --device_types=CPU --model_names=MobileNetV1 \
                            --target_abis=armeabi-v7a,arm64-v8a,aarch64,armhf

    Precision benchmark. Only supports ImageNet images as inputs for benchmarking MACE precision.

    bash tools/benchmark.sh --benchmark_option=Precision --input_dir=/path/to/inputs \
                            --executors=MACE --device_types=CPU --model_names=MobileNetV1 \
                            --target_abis=armeabi-v7a,arm64-v8a,aarch64,armhf
  • Check benchmark result

    python report/csv_to_html.py

    Open the corresponding link in a browser to see the report.

Adding a new AI executor

  • Define executor and implement the interfaces:

    class YourExecutor : public BaseExecutor {
     public:
      YourExecutor() :
          BaseExecutor(executor_type, device_type, model_file, weight_file) {}
      
      // Init method should invoke the initializing process for your executor 
      // (e.g.  Mace needs to compile OpenCL kernel once per target). It will be
      // called only once when creating executor engine.
      virtual Status Init(int num_threads);
    
      // Load model and prepare to run. It will be called only once before 
      // benchmarking the model.
      virtual Status Prepare();
      
      // Run the model. It will be called more than once.
      virtual Status Run(const std::map<std::string, BaseTensor> &inputs,
                         std::map<std::string, BaseTensor> *outputs);
      
      // Unload model and free the memory after benchmarking. It will be called
      // only once.
      virtual void Finish();
    };
  • Include your executor header in aibench/benchmark/benchmark_main.cc:

    #ifdef AIBENCH_ENABLE_YOUR_EXECUTOR
    #include "aibench/executors/your_executor/your_executor.h"
    #endif
  • Add dependencies to third_party/your_executor, aibench/benchmark/BUILD and WORKSPACE. Put macro AIBENCH_ENABLE_YOUR_EXECUTOR into aibench/benchmark/BUILD at model_benchmark target.

  • Benchmark a model on existing executor

    Refer to [Adding a model to run on existing executor](#Adding a model to run on existing executor).

License

Apache License 2.0.

Notice

For third party dependencies, please refer to their licenses.

mobile-ai-bench's People

Contributors

dustless avatar lee-bin avatar llhe avatar lu229 avatar lydoc avatar yuanlonglong-xiaomi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mobile-ai-bench's Issues

Not found mace/tflite/ncnn in Docker image mace-dev

I only found as below in latest image:

root@cross-compile:/opt# ls
android-ndk-r12b  android-ndk-r15c  android-ndk-r16  android-ndk-r17b  sdk

Does mace/tflite/ncnn/snpe need user to download and build? Thanks in advance.

build aborted: Analysis failed

Hi, when i executed python ./tools/benchmark.py, it shows logs as below:

$ python tools/benchmark.py 
Prepare to run models on armeabi-v7a
* Build //aibench/benchmark:model_benchmark with ABI armeabi-v7a
/system/lib/libcdsprpc.so does not exists! Skip DSP.
ERROR: /home/yuanshuai/code/mobile-ai-bench/aibench/executors/BUILD:57:1: no such package '@snpe//': Error downloading [https://cnbj1-fds.api.xiaomi.net/aibench/third_party/snpe-1.15.0.zip] to /home/yuanshuai/.cache/bazel/_bazel_yuanshuai/b2ea4545bb4fd72378513cc94a6e5886/external/snpe/snpe-1.15.0.zip: Unknown host: cnbj1-fds.api.xiaomi.net and referenced by '//aibench/executors:snpe_executor'
ERROR: Analysis of target '//aibench/benchmark:model_benchmark' failed; build aborted: Analysis failed
INFO: Elapsed time: 0.434s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (1 packages loaded)
Traceback (most recent call last):
  File "tools/benchmark.py", line 225, in <module>
    main(unused_args=[sys.argv[0]] + unparsed)
  File "tools/benchmark.py", line 208, in main
    runtimes)
  File "/home/yuanshuai/code/mobile-ai-bench/tools/sh_commands.py", line 206, in bazel_build
    *bazel_args)
  File "/usr/local/lib/python2.7/dist-packages/sh.py", line 1413, in __call__
    raise exc
sh.ErrorReturnCode_1: 

  RAN: /home/yuanshuai/bin/bazel build //aibench/benchmark:model_benchmark --config android --cpu=armeabi-v7a --action_env=ANDROID_NDK_HOME=/home/yuanshuai/software/android-ndk-r14b --define mace=true --define snpe=true --define ncnn=true --define tflite=true

  STDOUT:


  STDERR:

Has any benchmark result for NNlib

Hi, all!

Has any benchmark result for nnlib with mace, ncnn or etc? Besides, I wanna ask which performance is better between nnlib and SNPE?

Thanks in advance.

SNPE correctness problem

Hi, all,

I recently tested SNPE according its doc not mobile-ai-bench, and found its results are wrong for mobilenetv1, v2 on Snapdragon 835 (check using its Python scriptmodels/alexnet/scripts/show_alexnet_classifications.py).

Thus, I wanna ask do you verify the correctness? Thanks in advance.

Download SNPE model: Name or service not know

🙇

ERROR logs as below:

root@cross-compile:/opt/mobile-ai-bench# python ./tools/benchmark.py --frameworks=SNPE                     [83/99]
Prepare to run models on armeabi-v7a
* Build //aibench/benchmark:model_benchmark with ABI armeabi-v7a
/system/lib/libcdsprpc.so does not exists! Skip DSP.
INFO: Analysed target //aibench/benchmark:model_benchmark (17 packages loaded).
INFO: Found 1 target...
Target //aibench/benchmark:model_benchmark up-to-date:
  bazel-bin/aibench/benchmark/model_benchmark
INFO: Elapsed time: 9.494s, Critical Path: 0.71s
INFO: 3 processes, local.
INFO: Build completed successfully, 5 total actions
Build done!

=====================================================================
Trying to lock device ac516aca
Run on device: ac516aca, sdm660, Mi Note 3
Adjust power to performance mode on ac516aca, sdm660
adbd is already running as root
remount of /system failed: Read-only file system
remount failed
/system/bin/sh: can't create /sys/class/devfreq/1d84000.ufshc/governor: No such file or directory
/system/bin/sh: can't create /sys/class/devfreq/aa00000.qcom,vidc:arm9_bus_ddr/governor: No such file or directory
/system/bin/sh: can't create /sys/class/devfreq/aa00000.qcom,vidc:bus_cnoc/governor: No such file or directory
/system/bin/sh: can't create /sys/class/devfreq/aa00000.qcom,vidc:venus_bus_ddr/governor: No such file or director
y
/system/bin/sh: can't create /sys/class/devfreq/aa00000.qcom,vidc:venus_bus_llcc/governor: No such file or directory
bsnpe_dsp_skel.so                                                                                          [27/99]
Equal checksum with bazel-mobile-ai-bench/external/snpe/lib/dsp/libsnpe_dsp_domains_skel.so and /data/local/tmp/ai
bench/libsnpe_dsp_domains_skel.so
Equal checksum with bazel-mobile-ai-bench/external/snpe/lib/arm-android-gcc4.9/libSNPE_G.so and /data/local/tmp/ai
bench/libSNPE_G.so
Equal checksum with bazel-mobile-ai-bench/external/snpe/lib/arm-android-gcc4.9/libsymphony-cpu.so and /data/local/
tmp/aibench/libsymphony-cpu.so
Equal checksum with bazel-mobile-ai-bench/external/snpe/lib/arm-android-gcc4.9/libSNPE.so and /data/local/tmp/aibe
nch/libSNPE.so
Equal checksum with bazel-mobile-ai-bench/external/snpe/lib/arm-android-gcc4.9/libsymphonypower.so and /data/local
/tmp/aibench/libsymphonypower.so
Equal checksum with bazel-mobile-ai-bench/external/snpe/lib/arm-android-gcc4.9/libsnpe_dsp_domains.so and /data/lo
cal/tmp/aibench/libsnpe_dsp_domains.so
Equal checksum with bazel-mobile-ai-bench/external/snpe/lib/arm-android-gcc4.9/libsnpe_adsp.so and /data/local/tmp
/aibench/libsnpe_adsp.so
Equal checksum with /opt/android-ndk-r15c/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/libgnustl_shared.so a
nd /data/local/tmp/aibench/libgnustl_shared.so
Equal checksum with /opt/android-ndk-r15c/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/libgnustl_shared.so a
nd /data/local/tmp/aibench/libgnustl_shared.so
downloading inception_v3_quantized.dlc...
Traceback (most recent call last):
  File "./tools/benchmark.py", line 225, in <module>
    main(unused_args=[sys.argv[0]] + unparsed)
  File "./tools/benchmark.py", line 217, in main
    frameworks, model_names, runtimes, output_dir=FLAGS.output_dir)
  File "/opt/mobile-ai-bench/tools/sh_commands.py", line 340, in adb_run
    output_dir, frameworks, build_mace)
  File "/opt/mobile-ai-bench/tools/sh_commands.py", line 288, in prepare_all_model_and_input
    device_bin_path, output_dir)
  File "/opt/mobile-ai-bench/tools/sh_commands.py", line 264, in prepare_model_and_input
    download_file(models_inputs, file_name, output_dir)
  File "/opt/mobile-ai-bench/tools/sh_commands.py", line 156, in download_file
    urllib.urlretrieve(url, file_path)
  File "/usr/lib/python2.7/urllib.py", line 98, in urlretrieve
    return opener.retrieve(url, filename, reporthook, data)
  File "/usr/lib/python2.7/urllib.py", line 245, in retrieve
    fp = self.open(url, data)
  File "/usr/lib/python2.7/urllib.py", line 213, in open
    return getattr(self, name)(url)
  File "/usr/lib/python2.7/urllib.py", line 443, in open_https
    h.endheaders(data)
  File "/usr/lib/python2.7/httplib.py", line 1053, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python2.7/httplib.py", line 897, in _send_output
    self.send(msg)
  File "/usr/lib/python2.7/httplib.py", line 859, in send
    self.connect()
  File "/usr/lib/python2.7/httplib.py", line 1270, in connect
    HTTPConnection.connect(self)
  File "/usr/lib/python2.7/httplib.py", line 836, in connect
    self.timeout, self.source_address)
  File "/usr/lib/python2.7/socket.py", line 557, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
IOError: [Errno socket error] [Errno -2] Name or service not known

ARM Compute Library

Hi, thanks for this benchmark.
Are you planning on including ARM Compute Library in future version?

IOError: [Errno socket error] [Errno 0] Error

Configure the environment on x86 linux, then connect the computer data cable to the arm andriod device to run "bash tools/benchmark.sh --benchmark_option=Performance --target_abis=armeabi-v7a,arm64-v8a,aarch64,armhf", error "IOError: [Errno socket error] [Errno 0] Error"
INFO: Analysed target //aibench/python:benchmark (0 packages loaded).
INFO: Found 1 target...
Target //aibench/python:benchmark up-to-date:
bazel-bin/aibench/python/benchmark
INFO: Elapsed time: 0.289s, Critical Path: 0.00s
INFO: 0 processes.
INFO: Build completed successfully, 1 total action
downloading mobilenet-v1_1544063874.pb...
Traceback (most recent call last):
File "/home/liupeng/mobile-ai-bench-master/bazel-bin/aibench/python/benchmark.runfiles/aibench/aibench/python/benchmark.py", line 299, in
main(unused_args=[sys.argv[0]] + unparsed)
File "/home/liupeng/mobile-ai-bench-master/bazel-bin/aibench/python/benchmark.runfiles/aibench/aibench/python/benchmark.py", line 252, in main
FLAGS.output_dir)
File "/home/liupeng/mobile-ai-bench-master/aibench/python/sh_commands.py", line 368, in prepare_all_models
get_model(model, output_dir, push_list)
File "/home/liupeng/mobile-ai-bench-master/aibench/python/sh_commands.py", line 306, in get_model
output_dir, push_list)
File "/home/liupeng/mobile-ai-bench-master/aibench/python/sh_commands.py", line 293, in get_model_file
urllib.urlretrieve(file_path, local_file_path)
File "/usr/lib/python2.7/urllib.py", line 98, in urlretrieve
return opener.retrieve(url, filename, reporthook, data)
File "/usr/lib/python2.7/urllib.py", line 245, in retrieve
fp = self.open(url, data)
File "/usr/lib/python2.7/urllib.py", line 213, in open
return getattr(self, name)(url)
File "/usr/lib/python2.7/urllib.py", line 443, in open_https
h.endheaders(data)
File "/usr/lib/python2.7/httplib.py", line 1038, in endheaders
self._send_output(message_body)
File "/usr/lib/python2.7/httplib.py", line 882, in _send_output
self.send(msg)
File "/usr/lib/python2.7/httplib.py", line 844, in send
self.connect()
File "/usr/lib/python2.7/httplib.py", line 1263, in connect
server_hostname=server_hostname)
File "/usr/lib/python2.7/ssl.py", line 369, in wrap_socket
_context=self)
File "/usr/lib/python2.7/ssl.py", line 617, in init
self.do_handshake()
File "/usr/lib/python2.7/ssl.py", line 846, in do_handshake
self._sslobj.do_handshake()
IOError: [Errno socket error] [Errno 0] Error

mace 1.0.4 checksum not match

Hi, I am having problems with this depot. I have the correct environment but the downloaded mace-1.0.4 .zip shows that the checksum does not match.
If I comment the checksum verification lines, I can use NCNN as executor but not TFLITE and MACE.. So I am wondering maybe if XIaomi has changed the cloud depot?

TF.LITE GPU runtime error (Android Debug Bridge version 1.0.40)

adbd is already running as root
remount succeeded
710000000
Push third_party/tflite/tensorflow/contrib/lite/lib/arm64-v8a/libtensorflowLite.so to /data/local/tmp/aibench
Equal checksum with output/inception_v3.tflite and /data/local/tmp/aibench/inception_v3.tflite
Equal checksum with output/mobilenet_quant_v1_224.tflite and /data/local/tmp/aibench/mobilenet_quant_v1_224.tflite
Equal checksum with output/mobilenet_v1_1.0_224.tflite and /data/local/tmp/aibench/mobilenet_v1_1.0_224.tflite
Push bazel-bin/aibench/benchmark/model_benchmark to /data/local/tmp/aibench
Run /data/local/tmp/aibench/model_benchmark
('TFLITE', 'CPU', 'MobileNetV1')
WARNING: linker: Warning: "/data/local/tmp/aibench/model_benchmark" unused DT entry: DT_RPATH (type 0xf arg 0xea3) (ignoring)
sleep 10
benchmarking: MobileNetV1,3,0
benchmark: MobileNetV1,3,0,8.184,52.478
('TFLITE', 'CPU', 'MobileNetV2')
WARNING: linker: Warning: "/data/local/tmp/aibench/model_benchmark" unused DT entry: DT_RPATH (type 0xf arg 0xea3) (ignoring)
('TFLITE', 'CPU', 'SqueezeNetV11')
WARNING: linker: Warning: "/data/local/tmp/aibench/model_benchmark" unused DT entry: DT_RPATH (type 0xf arg 0xea3) (ignoring)
('TFLITE', 'CPU', 'InceptionV3')
WARNING: linker: Warning: "/data/local/tmp/aibench/model_benchmark" unused DT entry: DT_RPATH (type 0xf arg 0xea3) (ignoring)
sleep 10
benchmarking: InceptionV3,3,0
benchmark: InceptionV3,3,0,9.005,491.866
('TFLITE', 'CPU', 'VGG16')
WARNING: linker: Warning: "/data/local/tmp/aibench/model_benchmark" unused DT entry: DT_RPATH (type 0xf arg 0xea3) (ignoring)
('TFLITE', 'GPU', 'MobileNetV1')
WARNING: linker: Warning: "/data/local/tmp/aibench/model_benchmark" unused DT entry: DT_RPATH (type 0xf arg 0xea3) (ignoring)
('TFLITE', 'GPU', 'MobileNetV2')
WARNING: linker: Warning: "/data/local/tmp/aibench/model_benchmark" unused DT entry: DT_RPATH (type 0xf arg 0xea3) (ignoring)
('TFLITE', 'GPU', 'SqueezeNetV11')
WARNING: linker: Warning: "/data/local/tmp/aibench/model_benchmark" unused DT entry: DT_RPATH (type 0xf arg 0xea3) (ignoring)
('TFLITE', 'GPU', 'InceptionV3')
WARNING: linker: Warning: "/data/local/tmp/aibench/model_benchmark" unused DT entry: DT_RPATH (type 0xf arg 0xea3) (ignoring)
('TFLITE', 'GPU', 'VGG16')
WARNING: linker: Warning: "/data/local/tmp/aibench/model_benchmark" unused DT entry: DT_RPATH (type 0xf arg 0xea3) (ignoring)

Build failed with Mi Note 3

Thanks in advance. 🙇

1. My Installation Step

  1. cloned mobile-ai-bench in docker image registry.cn-hangzhou.aliyuncs.com/xiaomimace/mace-dev on my cross-compile machine using commands below:
docker pull registry.cn-hangzhou.aliyuncs.com/xiaomimace/mace-dev
docker run -it --privileged -d --name mace-dev \
           -v /dev/bus/usb:/dev/bus/usb --net=host \
           -v /local/path:/container/path \
           -v /usr/bin/docker:/usr/bin/docker \
           -v /var/run/docker.sock:/var/run/docker.sock \
           registry.cn-hangzhou.aliyuncs.com/xiaomimace/mace-dev
  1. downloaded snpe-1.8.0 and unzip to /opt as below:
root@cross-compile:/opt# ls
android-ndk-r12b  android-ndk-r16   mobile-ai-bench  snpe-1.18.0
android-ndk-r15c  android-ndk-r17b  sdk              snpe-1.18.0.zip
  1. edit snpe in WORKSPACE as below:
# You need to comment following new_http_archive and uncomment following           
# new_local_repository to benchmark SNPE                                           
#new_http_archive(                                                                 
#    name = "snpe",                                                                
#    build_file = "third_party/snpe/snpe.BUILD",                                   
#    sha256 = "b11780e5e7f591e916c69bdface4a1ef75b0c19f7b43c868bd62c0f3747d3fbb",
#    strip_prefix = "snpe-1.15.0",                                                 
#    urls = [                                                                      
#        "https://cnbj1-fds.api.xiaomi.net/aibench/third_party/snpe-1.15.0.zip",
#    ],                                                                            
#)                                                                                 
# You need to uncomment following new_local_repository and comment foregoing       
# new_http_archive to benchmark SNPE                                               
new_local_repository(                                                              
    name = "snpe",                                                                 
    build_file = "third_party/snpe/snpe.BUILD",                                    
    path = "/opt/snpe-1.18.0",                                                     
)

2. Issues

But build failed with 3 issues:

  1. Does mobile devices need to be root?
adbd cannot run as root in production builds
Not running as root. Try "adb root" first.
stop: must be root
/system/bin/sh: can't create /sys/devices/system/cpu/cpu7/online: Permission denied
/system/bin/sh: can't create /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor: Permission denied
......
......
  1. No such file or directory
/system/bin/sh: can't create /sys/class/devfreq/soc:qcom,l3-cdsp/governor: No such file or directory
  1. unused DT entry: type 0xf arg 0xf81
WARNING: linker: /data/local/tmp/aibench/model_benchmark: unused DT entry: type 0xf arg 0xf81
('snpe', 'CPU', 'MobileNetV2')

3. Error Logs

I execute python ./tools/benchmark.py --frameworks=snpe in mace-dev container as below:

root@cross-compile:/opt/mobile-ai-bench# python ./tools/benchmark.py --frameworks=snpe
Prepare to run models on armeabi-v7a
* Build //aibench/benchmark:model_benchmark with ABI armeabi-v7a
/system/lib/libcdsprpc.so does not exists! Skip DSP.
INFO: Analysed target //aibench/benchmark:model_benchmark (17 packages loaded).
INFO: Found 1 target...
[6 / 10] no action

Target //aibench/benchmark:model_benchmark up-to-date:
  bazel-bin/aibench/benchmark/model_benchmark
INFO: Elapsed time: 55.689s, Critical Path: 0.86s
INFO: 3 processes, local.
INFO: Build completed successfully, 5 total actions
Build done!

=====================================================================
Trying to lock device ac516aca
Run on device: ac516aca, sdm660, Mi Note 3
Adjust power to performance mode on ac516aca, sdm660
adbd cannot run as root in production builds
Not running as root. Try "adb root" first.
stop: must be root
stop: must be root
stop: must be root
stop: must be root
/system/bin/sh: can't create /sys/devices/system/cpu/cpu0/online: Permission denied
/system/bin/sh: can't create /sys/devices/system/cpu/cpu1/online: Permission denied
/system/bin/sh: can't create /sys/devices/system/cpu/cpu2/online: Permission denied
/system/bin/sh: can't create /sys/devices/system/cpu/cpu3/online: Permission denied
/system/bin/sh: can't create /sys/devices/system/cpu/cpu4/online: Permission denied
/system/bin/sh: can't create /sys/devices/system/cpu/cpu5/online: Permission denied
/system/bin/sh: can't create /sys/devices/system/cpu/cpu6/online: Permission denied
/system/bin/sh: can't create /sys/devices/system/cpu/cpu7/online: Permission denied
/system/bin/sh: can't create /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor: Permission denied
/system/bin/sh: can't create /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor: Permission denied
/system/bin/sh: can't create /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor: Permission denied
/system/bin/sh: can't create /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor: Permission denied
/system/bin/sh: can't create /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor: Permission denied
/system/bin/sh: can't create /sys/devices/system/cpu/cpu5/cpufreq/scaling_governor: Permission denied
/system/bin/sh: can't create /sys/devices/system/cpu/cpu6/cpufreq/scaling_governor: Permission denied
/system/bin/sh: can't create /sys/devices/system/cpu/cpu7/cpufreq/scaling_governor: Permission denied
/system/bin/sh: can't create /sys/class/devfreq/1d84000.ufshc/governor: No such file or directory
/system/bin/sh: can't create /sys/class/devfreq/5000000.qcom,kgsl-3d0/governor: Permission denied
/system/bin/sh: can't create /sys/class/devfreq/aa00000.qcom,vidc:arm9_bus_ddr/governor: No such file or directory
/system/bin/sh: can't create /sys/class/devfreq/aa00000.qcom,vidc:bus_cnoc/governor: No such file or directory
/system/bin/sh: can't create /sys/class/devfreq/aa00000.qcom,vidc:venus_bus_ddr/governor: No such file or directory
/system/bin/sh: can't create /sys/class/devfreq/aa00000.qcom,vidc:venus_bus_llcc/governor: No such file or directory
/system/bin/sh: can't create /sys/class/devfreq/soc:qcom,cpubw/governor: Permission denied
/system/bin/sh: can't create /sys/class/devfreq/soc:qcom,gpubw/governor: Permission denied
/system/bin/sh: can't create /sys/class/devfreq/soc:qcom,kgsl-busmon/governor: Permission denied
/system/bin/sh: can't create /sys/class/devfreq/soc:qcom,l3-cdsp/governor: No such file or directory
/system/bin/sh: can't create /sys/class/devfreq/soc:qcom,l3-cpu0/governor: No such file or directory
/system/bin/sh: can't create /sys/class/devfreq/soc:qcom,l3-cpu4/governor: No such file or directory
/system/bin/sh: can't create /sys/class/devfreq/soc:qcom,llccbw/governor: No such file or directory
/system/bin/sh: can't create /sys/class/devfreq/soc:qcom,memlat-cpu0/governor: Permission denied
/system/bin/sh: can't create /sys/class/devfreq/soc:qcom,memlat-cpu4/governor: Permission denied
/system/bin/sh: can't create /sys/class/devfreq/soc:qcom,mincpubw/governor: Permission denied
/system/bin/sh: can't create /sys/class/devfreq/soc:qcom,snoc_cnoc_keepalive/governor: No such file or directory
/system/bin/sh: can't create /sys/class/kgsl/kgsl-3d0/min_pwrlevel: Permission denied
/system/bin/sh: can't create /sys/class/kgsl/kgsl-3d0/max_pwrlevel: Permission denied
/system/bin/sh: can't create /sys/class/kgsl/kgsl-3d0/devfreq/governor: Permission denied
266000000
/system/bin/sh: can't create /sys/class/kgsl/kgsl-3d0/idle_timer: Permission denied
/system/bin/sh: can't create /d/dri/0/debug/core_perf/perf_mode: No such file or directory
/system/bin/sh: can't create /sys/devices/system/cpu/cpu0/core_ctl/min_cpus: Permission denied
/system/bin/sh: can't create /sys/devices/system/cpu/cpu4/core_ctl/min_cpus: Permission denied
/system/bin/sh: can't create /proc/sys/kernel/sched_downmigrate: Permission denied
/system/bin/sh: can't create /sys/block/sda/queue/nr_requests: No such file or directory
/system/bin/sh: can't create /dev/stune/top-app/schedtune.boost: Permission denied
/system/bin/sh: can't create /dev/stune/top-app/schedtune.prefer_idle: Permission denied
/system/bin/sh: can't create /sys/module/lpm_levels/parameters/sleep_disabled: Permission denied
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu0/pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu0/rail-pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu1/pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu1/rail-pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu2/pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu2/rail-pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu3/pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu3/rail-pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu4/pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu4/rail-pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu5/pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu5/rail-pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu6/pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu6/rail-pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu7/pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu7/rail-pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/l3-wfi/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/llcc-off/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/system/perf/cpu4/pc/idle_enabled: Permission denied
/system/bin/sh: can't create /sys/module/lpm_levels/system/perf/cpu5/pc/idle_enabled: Permission denied
/system/bin/sh: can't create /sys/module/lpm_levels/system/perf/cpu6/pc/idle_enabled: Permission denied
/system/bin/sh: can't create /sys/module/lpm_levels/system/perf/cpu7/pc/idle_enabled: Permission denied
/system/bin/sh: can't create /proc/sys/kernel/sched_initial_task_util: No such file or directory
/system/bin/sh: can't create /proc/sys/kernel/sched_init_task_load: Permission denied
/system/bin/sh: can't create /sys/kernel/debug/msm-bus-dbg/shell-client/mas: Permission denied
/system/bin/sh: can't create /sys/kernel/debug/msm-bus-dbg/shell-client/slv: Permission denied
/system/bin/sh: can't create /sys/kernel/debug/msm-bus-dbg/shell-client/ab: Permission denied
/system/bin/sh: can't create /sys/kernel/debug/msm-bus-dbg/shell-client/ib: Permission denied
/system/bin/sh: can't create /sys/kernel/debug/msm-bus-dbg/shell-client/update_request: Permission denied
Push bazel-bin/aibench/benchmark/model_benchmark to /data/local/tmp/aibench
Run /data/local/tmp/aibench/model_benchmark
('snpe', 'CPU', 'MobileNetV1')
WARNING: linker: /data/local/tmp/aibench/model_benchmark: unused DT entry: type 0xf arg 0xf81
('snpe', 'CPU', 'MobileNetV2')
WARNING: linker: /data/local/tmp/aibench/model_benchmark: unused DT entry: type 0xf arg 0xf81
('snpe', 'CPU', 'SqueezeNetV11')
WARNING: linker: /data/local/tmp/aibench/model_benchmark: unused DT entry: type 0xf arg 0xf81
('snpe', 'CPU', 'InceptionV3')
WARNING: linker: /data/local/tmp/aibench/model_benchmark: unused DT entry: type 0xf arg 0xf81
('snpe', 'CPU', 'VGG16')
WARNING: linker: /data/local/tmp/aibench/model_benchmark: unused DT entry: type 0xf arg 0xf81
('snpe', 'GPU', 'MobileNetV1')
WARNING: linker: /data/local/tmp/aibench/model_benchmark: unused DT entry: type 0xf arg 0xf81
('snpe', 'GPU', 'MobileNetV2')
WARNING: linker: /data/local/tmp/aibench/model_benchmark: unused DT entry: type 0xf arg 0xf81
('snpe', 'GPU', 'SqueezeNetV11')
WARNING: linker: /data/local/tmp/aibench/model_benchmark: unused DT entry: type 0xf arg 0xf81
('snpe', 'GPU', 'InceptionV3')
WARNING: linker: /data/local/tmp/aibench/model_benchmark: unused DT entry: type 0xf arg 0xf81
('snpe', 'GPU', 'VGG16')
WARNING: linker: /data/local/tmp/aibench/model_benchmark: unused DT entry: type 0xf arg 0xf81
('snpe', 'DSP', 'MobileNetV1')
WARNING: linker: /data/local/tmp/aibench/model_benchmark: unused DT entry: type 0xf arg 0xf81
('snpe', 'DSP', 'MobileNetV2')
WARNING: linker: /data/local/tmp/aibench/model_benchmark: unused DT entry: type 0xf arg 0xf81
('snpe', 'DSP', 'SqueezeNetV11')
WARNING: linker: /data/local/tmp/aibench/model_benchmark: unused DT entry: type 0xf arg 0xf81
('snpe', 'DSP', 'InceptionV3')
WARNING: linker: /data/local/tmp/aibench/model_benchmark: unused DT entry: type 0xf arg 0xf81
('snpe', 'DSP', 'VGG16')
WARNING: linker: /data/local/tmp/aibench/model_benchmark: unused DT entry: type 0xf arg 0xf81

Mi Note3解锁root问题

解锁完后,尝试了几个root软件,安全中心给了root软件了所有权限,但总是root不成功

使用Precision 结果不是1就是0

使用imageNet的图片及其它测试,置信度结果不是0.0就是1.0
期望比如有0.98这种的置信度

git pull
bash tools/benchmark.sh --benchmark_option=Precision --input_dir=/home/fu/mace/mobile-ai-bench/input_less --executors=MACE --device_types=CPU --model_names=MobileNetV1 --target_abis=armeabi-v7a

测试方法:input_dir只放一张图片,运行上述脚本, cat output/precision_report.csv

ILSVRC2012_val_00000005.JPEG 0.0
ILSVRC2012_val_00000007.JPEG 1.0
ILSVRC2012_val_00000009.JPEG 1.0

测试Preformance,看上去正常
android-ndk-r15c

QQ号 744734320

can't use TFLITE NCNN in a sda845 through adb.

HI,all
I want to run the mobile-ai-bench in android sda845 and use TFlite and NCNN to measure the performance of inference.

abi: arm64-v8a,armeabi-v7a,armeabi
sdk:27
android version: 8.1.0

when I run the commandbash tools/benchmark.sh --benchmark_option=Performance --executors=NCNN --target_abis=armeabi-v7a,arm64-v8a, I get the error

INFO: Found 1 target...
Target //aibench/python:benchmark up-to-date:
  bazel-bin/aibench/python/benchmark
INFO: Elapsed time: 0.574s, Critical Path: 0.01s
Find qualcomm adb device:5bc6606e
No Arm linux device yaml file
Prepare to run models on armeabi-v7a
Equal checksum with output/benchmark.pb and /data/local/tmp/aibench/benchmark.pb
Equal checksum with output/model.pb and /data/local/tmp/aibench/model.pb
Equal checksum with output/mobilenet.param and /data/local/tmp/aibench/mobilenet.param
Equal checksum with output/mobilenet_v2.param and /data/local/tmp/aibench/mobilenet_v2.param
Equal checksum with output/inception_v3.param and /data/local/tmp/aibench/inception_v3.param
Equal checksum with output/squeezenet.param and /data/local/tmp/aibench/squeezenet.param
* Build //aibench/benchmark:model_benchmark for NCNN with ABI armeabi-v7a
WARNING: The major revision of the Android NDK referenced by android_ndk_repository rule 'androidndk' is 15. The major revisions supported by Bazel are [10, 11, 12, 13, 14]. Defaulting to revision 14.
ERROR: /home/ubuntu/workspace/benchmark_tool/source_code/mobile-ai-bench/aibench/executors/BUILD:87:1: no such package '@ncnn//': Error extracting /home/ubuntu/.cache/bazel/_bazel_wang/486fc9acf5761970e8f8cbc79af240fd/external/ncnn/ncnn-20180830.zip to /home/ubuntu/.cache/bazel/_bazel_wang/486fc9acf5761970e8f8cbc79af240fd/external/ncnn: Zip entries cannot refer to files outside of their directory: ncnn-20180830.zip has a symlink to ../../squeezenet_v1.1.bin and referenced by '//aibench/executors:ncnn_executor'.
ERROR: Analysis of target '//aibench/benchmark:model_benchmark' failed; build aborted.
INFO: Elapsed time: 9.747s
Traceback (most recent call last):
  File "/home/ubuntu/workspace/benchmark_tool/source_code/mobile-ai-bench/bazel-bin/aibench/python/benchmark.runfiles/aibench/aibench/python/benchmark.py", line 354, in <module>
    main(unused_args=[sys.argv[0]] + unparsed)
  File "/home/ubuntu/workspace/benchmark_tool/source_code/mobile-ai-bench/bazel-bin/aibench/python/benchmark.runfiles/aibench/aibench/python/benchmark.py", line 343, in main
    benchmark_option, benchmark_list, result_files,)
  File "/home/ubuntu/workspace/benchmark_tool/source_code/mobile-ai-bench/bazel-bin/aibench/python/benchmark.runfiles/aibench/aibench/python/benchmark.py", line 261, in run_on_device
    avail_device_types)
  File "/home/ubuntu/workspace/benchmark_tool/source_code/mobile-ai-bench/aibench/python/bench_engine.py", line 117, in bazel_build
    *bazel_args)
  File "/home/ubuntu/anaconda3/envs/mobile-ai-bench_env/lib/python2.7/site-packages/sh.py", line 1413, in __call__
    raise exc
sh.ErrorReturnCode_1: 

  RAN: /home/ubuntu/bin/bazel build //aibench/benchmark:model_benchmark --config android --cpu=armeabi-v7a --action_env=ANDROID_NDK_HOME=/home/ubuntu/Android/ndk/android-ndk-r15c --define ncnn=true

  STDOUT:


  STDERR:

when I run the commandbash tools/benchmark.sh --benchmark_option=Performance --executors=TFLITE --target_abis=armeabi-v7a,arm64-v8a
I also get the error

INFO: Found 1 target...
Target //aibench/python:benchmark up-to-date:
  bazel-bin/aibench/python/benchmark
INFO: Elapsed time: 0.539s, Critical Path: 0.01s
Find qualcomm adb device:5bc6606e
No Arm linux device yaml file
Prepare to run models on armeabi-v7a
Equal checksum with output/benchmark.pb and /data/local/tmp/aibench/benchmark.pb
Equal checksum with output/model.pb and /data/local/tmp/aibench/model.pb
Equal checksum with output/mobilenet_v1_1.0_224.tflite and /data/local/tmp/aibench/mobilenet_v1_1.0_224.tflite
Equal checksum with output/mobilenet_v2_1.0_224.tflite and /data/local/tmp/aibench/mobilenet_v2_1.0_224.tflite
Equal checksum with output/inception_v3.tflite and /data/local/tmp/aibench/inception_v3.tflite
Equal checksum with output/mobilenet_quant_v1_224.tflite and /data/local/tmp/aibench/mobilenet_quant_v1_224.tflite
Equal checksum with output/mobilenet_v2_1.0_224_quant.tflite and /data/local/tmp/aibench/mobilenet_v2_1.0_224_quant.tflite
Equal checksum with output/inception_v3_quant.tflite and /data/local/tmp/aibench/inception_v3_quant.tflite
* Build //aibench/benchmark:model_benchmark for TFLITE with ABI armeabi-v7a
WARNING: The major revision of the Android NDK referenced by android_ndk_repository rule 'androidndk' is 15. The major revisions supported by Bazel are [10, 11, 12, 13, 14]. Defaulting to revision 14.
INFO: Found 1 target...
ERROR: /home/ubuntu/workspace/benchmark_tool/source_code/mobile-ai-bench/aibench/benchmark/BUILD:52:1: Linking of rule '//aibench/benchmark:model_benchmark' failed (Exit 1): clang failed: error executing command 
  (cd /home/ubuntu/.cache/bazel/_bazel_wang/486fc9acf5761970e8f8cbc79af240fd/execroot/aibench && \
  exec env - \
    ANDROID_NDK_HOME=/home/ubuntu/Android/ndk/android-ndk-r15c \
    LD_LIBRARY_PATH=/home/ubuntu/workspace/test_ws/devel/lib:/home/ubuntu/workspace/ros/devel/lib:/opt/ros/kinetic/lib:/home/ubuntu/workspace/awaken_project/demo/libs/x64/ \
    PATH=/home/ubuntu/.cargo/bin:/opt/ros/kinetic/bin:/home/ubuntu/.cargo/bin:/home/ubuntu/anaconda3/envs/mobile-ai-bench_env/bin:/home/ubuntu/Downloads/DeepLearning/android-ndk-r17c:/home/ubuntu/.cargo/bin:/home/ubuntu/anaconda3/condabin:/home/ubuntu/.cargo/bin:/home/ubuntu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/gcc/gcc-arm-none-eabi-7-2017-q4-major/bin:/home/ubuntu/Downloads/DeepLearning/android-ndk-r17c:/home/ubuntu/Downloads/DeepLearning/android-ndk-r17c:/home/ubuntu/Downloads/DeepLearning/android-ndk-r17c \
    PWD=/proc/self/cwd \
  external/androidndk/ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -o bazel-out/arm-linux-androideabi-clang3.8-v7a-gnu-libstdcpp-opt/bin/aibench/benchmark/model_benchmark '-Wl,-rpath,$EXEC_ORIGIN/../../_solib_armeabi-v7a/_U@opencv_S_S_Copencv_Uarmeabi-v7a___Uexternal_Sopencv_Slibs_Sarmeabi-v7a' '-Wl,-rpath,$EXEC_ORIGIN/../../_solib_armeabi-v7a/_U_S_Sthird_Uparty_Stflite_Ctflite_Uarmeabi-v7a___Uthird_Uparty_Stflite_Stensorflow_Slite_Slib_Sarmeabi-v7a' -Lbazel-out/arm-linux-androideabi-clang3.8-v7a-gnu-libstdcpp-opt/bin/_solib_armeabi-v7a/_U@opencv_S_S_Copencv_Uarmeabi-v7a___Uexternal_Sopencv_Slibs_Sarmeabi-v7a -Lbazel-out/arm-linux-androideabi-clang3.8-v7a-gnu-libstdcpp-opt/bin/_solib_armeabi-v7a/_U_S_Sthird_Uparty_Stflite_Ctflite_Uarmeabi-v7a___Uthird_Uparty_Stflite_Stensorflow_Slite_Slib_Sarmeabi-v7a bazel-out/arm-linux-androideabi-clang3.8-v7a-gnu-libstdcpp-opt/bin/aibench/benchmark/_objs/model_benchmark/aibench/benchmark/benchmark_main.o -Wl,-whole-archive bazel-out/arm-linux-androideabi-clang3.8-v7a-gnu-libstdcpp-opt/bin/aibench/benchmark/libbenchmark.lo -Wl,-no-whole-archive bazel-out/arm-linux-androideabi-clang3.8-v7a-gnu-libstdcpp-opt/bin/external/mace/mace/utils/libutils.a -lopencv_java4 bazel-out/arm-linux-androideabi-clang3.8-v7a-gnu-libstdcpp-opt/bin/external/com_github_gflags_gflags/libgflags_nothreads.a bazel-out/arm-linux-androideabi-clang3.8-v7a-gnu-libstdcpp-opt/bin/aibench/executors/libtflite_executor.a bazel-out/arm-linux-androideabi-clang3.8-v7a-gnu-libstdcpp-opt/bin/aibench/executors/libbase_executor.a bazel-out/arm-linux-androideabi-clang3.8-v7a-gnu-libstdcpp-opt/bin/aibench/proto/libaibench_proto_cc.a bazel-out/arm-linux-androideabi-clang3.8-v7a-gnu-libstdcpp-opt/bin/external/com_google_protobuf/libprotobuf_lite.a -ltensorflowLite external/androidndk/ndk/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/libgnustl_static.a external/androidndk/ndk/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/libsupc++.a -fopenmp -ldl -pie -lm -llog -lz -ldl -lm -llog -static-libgcc -gcc-toolchain external/androidndk/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64 -no-canonical-prefixes -target armv7-none-linux-androideabi -Wl,--fix-cortex-a8 -Wl,--strip-all -Wl,--gc-sections -Wl,--strip-all -Wl,--gc-sections '--sysroot=external/androidndk/ndk/platforms/android-24/arch-arm')

Use --sandbox_debug to see verbose messages from the sandbox.
aibench/executors/tflite/tflite_executor.cc:47: error: undefined reference to 'tflite::InterpreterBuilder::operator()(std::unique_ptr<tflite::Interpreter, std::default_delete<tflite::Interpreter> >*)'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Target //aibench/benchmark:model_benchmark failed to build
INFO: Elapsed time: 2.346s, Critical Path: 0.85s
Traceback (most recent call last):
  File "/home/ubuntu/workspace/benchmark_tool/source_code/mobile-ai-bench/bazel-bin/aibench/python/benchmark.runfiles/aibench/aibench/python/benchmark.py", line 354, in <module>
    main(unused_args=[sys.argv[0]] + unparsed)
  File "/home/ubuntu/workspace/benchmark_tool/source_code/mobile-ai-bench/bazel-bin/aibench/python/benchmark.runfiles/aibench/aibench/python/benchmark.py", line 343, in main
    benchmark_option, benchmark_list, result_files,)
  File "/home/ubuntu/workspace/benchmark_tool/source_code/mobile-ai-bench/bazel-bin/aibench/python/benchmark.runfiles/aibench/aibench/python/benchmark.py", line 261, in run_on_device
    avail_device_types)
  File "/home/ubuntu/workspace/benchmark_tool/source_code/mobile-ai-bench/aibench/python/bench_engine.py", line 117, in bazel_build
    *bazel_args)
  File "/home/ubuntu/anaconda3/envs/mobile-ai-bench_env/lib/python2.7/site-packages/sh.py", line 1413, in __call__
    raise exc
sh.ErrorReturnCode_1: 

  RAN: /home/ubuntu/bin/bazel build //aibench/benchmark:model_benchmark --config android --cpu=armeabi-v7a --action_env=ANDROID_NDK_HOME=/home/ubuntu/Android/ndk/android-ndk-r15c --define tflite=true

  STDOUT:


  STDERR:

Thanks for your time.

The speed of quantized tflite model is slower than its float model.

I benchmarked the models on the OnePlus 3T platform, The performance of tflite quantized models are worse than the float modes. Has anyone run into the same issue?

The command I used:

python tools/benchmark.py --output_dir=output --frameworks=all \
--runtimes=all --model_names=all \
--target_abis=arm64-v8a

model_name device_name soc abi runtime MACE SNPE NCNN TFLITE
InceptionV3 ONEPLUS A3010 msm8996 arm64-v8a CPU 886.312 664.404 1578.295 997
InceptionV3 ONEPLUS A3010 msm8996 arm64-v8a DSP   4.996    
InceptionV3 ONEPLUS A3010 msm8996 arm64-v8a GPU 153.049 141.246    
InceptionV3Quant ONEPLUS A3010 msm8996 arm64-v8a CPU       1014.75
MobileNetV1 ONEPLUS A3010 msm8996 arm64-v8a CPU 52.046 385.444 37.883 71.367
MobileNetV1 ONEPLUS A3010 msm8996 arm64-v8a GPU 25.267 24.441    
MobileNetV1Quant ONEPLUS A3010 msm8996 arm64-v8a CPU 36.743     145.778
MobileNetV2 ONEPLUS A3010 msm8996 arm64-v8a CPU 40.625 413.553 29.208 76.021
MobileNetV2 ONEPLUS A3010 msm8996 arm64-v8a GPU 17.546 14.966    
MobileNetV2Quant ONEPLUS A3010 msm8996 arm64-v8a CPU 28.679     294.099
SqueezeNetV11 ONEPLUS A3010 msm8996 arm64-v8a CPU 37.453 59.481 21.376  
SqueezeNetV11 ONEPLUS A3010 msm8996 arm64-v8a GPU 20.001 17.986    
VGG16 ONEPLUS A3010 msm8996 arm64-v8a CPU 452.521 1002.442 821.195  
VGG16 ONEPLUS A3010 msm8996 arm64-v8a DSP   136.465    
VGG16 ONEPLUS A3010 msm8996 arm64-v8a GPU 196.507      

ImportError: No module named jinja2

HI, all

I want to run the benchmarking tool on my device through ssh, when I run the

bash tools/benchmark.sh --benchmark_option=Performance \
                        --target_abis=aarch64

Then , I need to enter my password again and again.

But in the end I get the error
Selection_005

I use anaconda to create python virtualenv , and my installed python package
Selection_006
And, I am sure that I get the lastest version of Jinja2.

Thanks for your help.

Mi Note3 run error: governor: No such file or directory, unused DT entry: type 0xf arg 0xf81

Hi, I have two problems when running as below.

1. My Installation Step

  1. cloned mobile-ai-bench in docker image registry.cn-hangzhou.aliyuncs.com/xiaomimace/mace-dev on my cross-compile machine using commands below:
docker pull registry.cn-hangzhou.aliyuncs.com/xiaomimace/mace-dev
docker run -it --privileged -d --name mace-dev \
           -v /dev/bus/usb:/dev/bus/usb --net=host \
           -v /local/path:/container/path \
           -v /usr/bin/docker:/usr/bin/docker \
           -v /var/run/docker.sock:/var/run/docker.sock \
           registry.cn-hangzhou.aliyuncs.com/xiaomimace/mace-dev
  1. downloaded snpe-1.8.0 and unzip to /opt as below:
root@cross-compile:/opt# ls
android-ndk-r12b  android-ndk-r16   mobile-ai-bench  snpe-1.18.0
android-ndk-r15c  android-ndk-r17b  sdk              snpe-1.18.0.zip
  1. edit snpe in WORKSPACE as below:
# You need to comment following new_http_archive and uncomment following           
# new_local_repository to benchmark SNPE                                           
#new_http_archive(                                                                 
#    name = "snpe",                                                                
#    build_file = "third_party/snpe/snpe.BUILD",                                   
#    sha256 = "b11780e5e7f591e916c69bdface4a1ef75b0c19f7b43c868bd62c0f3747d3fbb",
#    strip_prefix = "snpe-1.15.0",                                                 
#    urls = [                                                                      
#        "https://cnbj1-fds.api.xiaomi.net/aibench/third_party/snpe-1.15.0.zip",
#    ],                                                                            
#)                                                                                 
# You need to uncomment following new_local_repository and comment foregoing       
# new_http_archive to benchmark SNPE                                               
new_local_repository(                                                              
    name = "snpe",                                                                 
    build_file = "third_party/snpe/snpe.BUILD",                                    
    path = "/opt/snpe-1.18.0",                                                     
)

2. Issues

But build failed with 2 issues:

  1. No such file or directory
/system/bin/sh: can't create /sys/class/devfreq/soc:qcom,l3-cdsp/governor: No such file or directory
  1. unused DT entry: type 0xf arg 0xf81
WARNING: linker: /data/local/tmp/aibench/model_benchmark: unused DT entry: type 0xf arg 0xf81
('snpe', 'CPU', 'MobileNetV2')

3. Error Log

root@cross-compile:/opt/mobile-ai-bench# python tools/benchmark.py --output_dir=output --frameworks=snpe \
> 
Prepare to run models on armeabi-v7a
* Build //aibench/benchmark:model_benchmark with ABI armeabi-v7a
/system/lib/libcdsprpc.so does not exists! Skip DSP.
INFO: Analysed target //aibench/benchmark:model_benchmark (17 packages loaded).
INFO: Found 1 target...
Target //aibench/benchmark:model_benchmark up-to-date:
  bazel-bin/aibench/benchmark/model_benchmark
INFO: Elapsed time: 61.398s, Critical Path: 1.79s
INFO: 3 processes, local.
INFO: Build completed successfully, 5 total actions
Build done!

=====================================================================
Trying to lock device ac516aca
Run on device: ac516aca, sdm660, Mi Note 3
Adjust power to performance mode on ac516aca, sdm660
adbd is already running as root
remount succeeded
/system/bin/sh: can't create /sys/class/devfreq/1d84000.ufshc/governor: No such file or directory
/system/bin/sh: can't create /sys/class/devfreq/aa00000.qcom,vidc:arm9_bus_ddr/governor: No such file or directory
/system/bin/sh: can't create /sys/class/devfreq/aa00000.qcom,vidc:bus_cnoc/governor: No such file or directory
/system/bin/sh: can't create /sys/class/devfreq/aa00000.qcom,vidc:venus_bus_ddr/governor: No such file or directory
/system/bin/sh: can't create /sys/class/devfreq/aa00000.qcom,vidc:venus_bus_llcc/governor: No such file or directory
/system/bin/sh: can't create /sys/class/devfreq/soc:qcom,l3-cdsp/governor: No such file or directory
/system/bin/sh: can't create /sys/class/devfreq/soc:qcom,l3-cpu0/governor: No such file or directory
/system/bin/sh: can't create /sys/class/devfreq/soc:qcom,l3-cpu4/governor: No such file or directory
/system/bin/sh: can't create /sys/class/devfreq/soc:qcom,llccbw/governor: No such file or directory
/system/bin/sh: can't create /sys/class/devfreq/soc:qcom,snoc_cnoc_keepalive/governor: No such file or directory
647000000
/system/bin/sh: can't create /d/dri/0/debug/core_perf/perf_mode: No such file or directory
/system/bin/sh: can't create /sys/block/sda/queue/nr_requests: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu0/pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu0/rail-pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu1/pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu1/rail-pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu2/pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu2/rail-pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu3/pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu3/rail-pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu4/pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu4/rail-pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu5/pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu5/rail-pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu6/pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu6/rail-pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu7/pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu7/rail-pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/l3-wfi/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/llcc-off/idle_enabled: No such file or directory
Push bazel-bin/aibench/benchmark/model_benchmark to /data/local/tmp/aibench
Run /data/local/tmp/aibench/model_benchmark
('snpe', 'CPU', 'MobileNetV1')
WARNING: linker: "/data/local/tmp/aibench/model_benchmark" unused DT entry: type 0xf arg 0xf81
('snpe', 'CPU', 'MobileNetV2')
WARNING: linker: "/data/local/tmp/aibench/model_benchmark" unused DT entry: type 0xf arg 0xf81
('snpe', 'CPU', 'SqueezeNetV11')
WARNING: linker: "/data/local/tmp/aibench/model_benchmark" unused DT entry: type 0xf arg 0xf81
('snpe', 'CPU', 'InceptionV3')
WARNING: linker: "/data/local/tmp/aibench/model_benchmark" unused DT entry: type 0xf arg 0xf81
('snpe', 'CPU', 'VGG16')
WARNING: linker: "/data/local/tmp/aibench/model_benchmark" unused DT entry: type 0xf arg 0xf81
('snpe', 'GPU', 'MobileNetV1')
WARNING: linker: "/data/local/tmp/aibench/model_benchmark" unused DT entry: type 0xf arg 0xf81
('snpe', 'GPU', 'MobileNetV2')
WARNING: linker: "/data/local/tmp/aibench/model_benchmark" unused DT entry: type 0xf arg 0xf81
('snpe', 'GPU', 'SqueezeNetV11')
WARNING: linker: "/data/local/tmp/aibench/model_benchmark" unused DT entry: type 0xf arg 0xf81
('snpe', 'GPU', 'InceptionV3')
WARNING: linker: "/data/local/tmp/aibench/model_benchmark" unused DT entry: type 0xf arg 0xf81
('snpe', 'GPU', 'VGG16')
WARNING: linker: "/data/local/tmp/aibench/model_benchmark" unused DT entry: type 0xf arg 0xf81
('snpe', 'DSP', 'MobileNetV1')
WARNING: linker: "/data/local/tmp/aibench/model_benchmark" unused DT entry: type 0xf arg 0xf81
('snpe', 'DSP', 'MobileNetV2')
WARNING: linker: "/data/local/tmp/aibench/model_benchmark" unused DT entry: type 0xf arg 0xf81
('snpe', 'DSP', 'SqueezeNetV11')
WARNING: linker: "/data/local/tmp/aibench/model_benchmark" unused DT entry: type 0xf arg 0xf81
('snpe', 'DSP', 'InceptionV3')
WARNING: linker: "/data/local/tmp/aibench/model_benchmark" unused DT entry: type 0xf arg 0xf81
('snpe', 'DSP', 'VGG16')
WARNING: linker: "/data/local/tmp/aibench/model_benchmark" unused DT entry: type 0xf arg 0xf81

如何理解最后benchmark各项的结果呢

你好,

  1. 如何理解 Prepare Time 么, 代表第一次加载模型所需要的时间么
  2. 那么各个框架下对应的时间单位是ms么 ,还是对应的是FPS呢
  3. Run Time Average 代表, 推理一张图片所需要的时间么

('SNPE', 'MobileNetV1', 'CPU', 'Float') ('SNPE', 'MobileNetV1', 'GPU', 'Float') ('SNPE', 'MobileNetV2', 'CPU', 'Float') ('SNPE', 'MobileNetV2', 'GPU', 'Float') ('SNPE', 'InceptionV3', 'CPU', 'Float') ('SNPE', 'InceptionV3', 'GPU', 'Float') ('SNPE', 'InceptionV3', 'DSP', 'Quantized') Elapse time: 2.140218 minutes.
将最后的结果按ms单位 求和,以与上面的算出的数值出入过大?

`Prepare Time (see FAQ section in README for more explanations)

+---------------+-----------+-----------+--------+-------------+--------+----------+----------+----------+---------+------+
| model_name | quantize | product | soc | abi | device | MACE | SNPE | TFLITE | NCNN | HIAI |
+---------------+-----------+-----------+--------+-------------+--------+----------+----------+----------+---------+------+
| InceptionV3 | Float | Mi Note 3 | sdm660 | arm64-v8a | CPU | 511.42 | 526.721 | 1.572 | 233.964 | |
| InceptionV3 | Float | Mi Note 3 | sdm660 | arm64-v8a | GPU | 444.626 | 2138.165 | 7957.576 | | |
| InceptionV3 | Float | Mi Note 3 | sdm660 | armeabi-v7a | CPU | 547.094 | 534.047 | 1.406 | 195.117 | |
| InceptionV3 | Float | Mi Note 3 | sdm660 | armeabi-v7a | GPU | 476.769 | 2287.24 | 7573.171 | | |`

十分感谢答复

Cannot connect USB using docker on MacOS

hi, I run this docker images according to MACE docs: using docker section as below.

# Create a container named `mace-dev`
docker run -it --privileged -d --name mace-dev \
           -v /dev/bus/usb:/dev/bus/usb --net=host \
           -v /local/path:/container/path \
           -v /usr/bin/docker:/usr/bin/docker \
           -v /var/run/docker.sock:/var/run/docker.sock \
           registry.cn-hangzhou.aliyuncs.com/xiaomimace/mace-dev-lite
# Execute an interactive bash shell on the container
docker exec -it mace-dev /bin/bash

However, my system is MacOS, something with USB devices not match: MacOS doesn't have /dev/bus/usb path. Have any idea? Thanks in advance.

can't support aarch64_linux SNPE

Hi, all
system info

devices sda845
abi  aarch64
os ubuntu 16.04

when I run the command bash tools/benchmark.sh --benchmark_option=Performance --target_abis=aarch64 --executors=SNPE
I get the error

(mobile-ai-bench_env) wang@ubuntu-pc:~/workspace/benchmark_tool/source_code/mobile-ai-bench$ bash tools/benchmark.sh --benchmark_option=Performance --target_abis=aarch64 --executors=SNPE
INFO: Found 1 target...
Target //aibench/python:benchmark up-to-date:
  bazel-bin/aibench/python/benchmark
INFO: Elapsed time: 0.169s, Critical Path: 0.00s
Find ssh device:sda845
Prepare to run models on aarch64
Skip device  which doesn't support current executors

I am so con confused why the executors can not run in the devices. Because I find the

cc_library(
    name = "snpe_aarch64",
    srcs = [
        "lib/aarch64-linux-gcc4.9/libSNPE.so",
        "lib/aarch64-linux-gcc4.9/libsymphony-cpu.so",
    ],
    deps = ["snpe_hdr"],
    visibility = ["//visibility:public"],
)

in the file named mobile-ai-bench/third_party/snpe/snpe.BUILD .
thanks for your time.

file libmace.zip md5 checksum not match

Try to run mobile-ai-bench but libmace md5 checksum fail

~/xiaomi/mobile-ai-bench$ python tools/benchmark.py --output_dir=output --frameworks=all \

                      --runtimes=all --model_names=all \
                      --target_abis=armeabi-v7a,arm64-v8a

downloading libmace.zip...
file libmace.zip md5 checksum not match

dry run mobile-ai-bench but fail on snapdragon sdm660, sdm845

~/xiaomi/mobile-ai-bench$ python tools/benchmark.py --output_dir=output --frameworks=MACE --runtimes=CPU --model_names=MobileNetV1 --target_abis=armeabi-v7a
Prepare to run models on armeabi-v7a

  • Build //aibench/benchmark:model_benchmark with ABI armeabi-v7a
    INFO: Analysed target //aibench/benchmark:model_benchmark (0 packages loaded).
    INFO: Found 1 target...
    Target //aibench/benchmark:model_benchmark up-to-date:
    bazel-bin/aibench/benchmark/model_benchmark
    INFO: Elapsed time: 0.413s, Critical Path: 0.03s
    INFO: 0 processes.
    INFO: Build completed successfully, 1 total action
    Build done!

=====================================================================
Trying to lock device d699ac95
Run on device: d699ac95, sdm660, sdm660 for arm64
Adjust power to performance mode on d699ac95, sdm660
adbd is already running as root
remount succeeded
/system/bin/sh: can't create /sys/class/devfreq/1d84000.ufshc/governor: No such file or directory
/system/bin/sh: can't create /sys/class/devfreq/aa00000.qcom,vidc:arm9_bus_ddr/governor: No such file or directory
/system/bin/sh: can't create /sys/class/devfreq/aa00000.qcom,vidc:bus_cnoc/governor: No such file or directory
/system/bin/sh: can't create /sys/class/devfreq/aa00000.qcom,vidc:venus_bus_ddr/governor: No such file or directory
/system/bin/sh: can't create /sys/class/devfreq/aa00000.qcom,vidc:venus_bus_llcc/governor: No such file or directory
/system/bin/sh: can't create /sys/class/devfreq/soc:qcom,l3-cdsp/governor: No such file or directory
/system/bin/sh: can't create /sys/class/devfreq/soc:qcom,l3-cpu0/governor: No such file or directory
/system/bin/sh: can't create /sys/class/devfreq/soc:qcom,l3-cpu4/governor: No such file or directory
/system/bin/sh: can't create /sys/class/devfreq/soc:qcom,llccbw/governor: No such file or directory
/system/bin/sh: can't create /sys/class/devfreq/soc:qcom,snoc_cnoc_keepalive/governor: No such file or directory
647000000
/system/bin/sh: can't create /d/dri/0/debug/core_perf/perf_mode: No such file or directory
/system/bin/sh: can't create /sys/block/sda/queue/nr_requests: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu0/pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu0/rail-pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu1/pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu1/rail-pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu2/pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu2/rail-pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu3/pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu3/rail-pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu4/pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu4/rail-pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu5/pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu5/rail-pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu6/pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu6/rail-pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu7/pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu7/rail-pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/l3-wfi/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/llcc-off/idle_enabled: No such file or directory
Traceback (most recent call last):
File "tools/benchmark.py", line 225, in
main(unused_args=[sys.argv[0]] + unparsed)
File "tools/benchmark.py", line 217, in main
frameworks, model_names, runtimes, output_dir=FLAGS.output_dir)
File "/home/xiaomi/mobile-ai-bench/tools/sh_commands.py", line 333, in adb_run
prepare_device_env(serialno, abi, device_bin_path, frameworks)
File "/home/xiaomi/mobile-ai-bench/tools/sh_commands.py", line 234, in prepare_device_env
device_bin_path, serialno)
File "/home/xiaomi/mobile-ai-bench/tools/sh_commands.py", line 121, in adb_push
adb_push_file(src_path, dst_dir, serialno)
File "/home/xiaomi/mobile-ai-bench/tools/sh_commands.py", line 107, in adb_push_file
_out=lambda line: stdout_buff.append(line))
File "/usr/local/lib/python2.7/dist-packages/sh.py", line 1427, in call
return RunningCommand(cmd, call_args, stdin, stdout, stderr)
File "/usr/local/lib/python2.7/dist-packages/sh.py", line 774, in init
self.wait()
File "/usr/local/lib/python2.7/dist-packages/sh.py", line 792, in wait
self.handle_command_exit_code(exit_code)
File "/usr/local/lib/python2.7/dist-packages/sh.py", line 815, in handle_command_exit_code
raise exc
sh.ErrorReturnCode_1:

RAN: /bin/adb -s d699ac95 shell md5sum /data/local/tmp/aibench/libhexagon_controller.so

STDOUT:

STDERR:
md5sum: /data/local/tmp/aibench/libhexagon_controller.so: No such file or directory

Error: Build did NOT complete successfully

Hi.

I am experiencing this error. Could you please help?

  • Environment:

    • Ubuntu 18.04
    • Pixel 2, Andorid 8.1 (Tried with Pixel 4, Android 10 and got the same error)
  • I made some source change

    • benchmark.meta
      • cannot access https://cnbj1.fds.api.xiaomi.com so I put one benchmarks{ ... } with accessible URL and remove other than this one.

         benchmarks {
         executor: TFLITE
         models {
           model_name: InceptionV3
           model_path: "http://some url/TF_IV3_03.toco.tflite"
           model_checksum: "d2da062e325a54b512c3816714454deb" <-- result of md5sum
           devices: CPU
           devices: GPU
           input_names: "input"
           }
         }
        
      
      
    • config.yml
      • cannot access https://cnbj1.fds.api.xiaomi.com so I uploaded tensorflow into accessible URL
      • but didn't change URL of imagenet_less.zip yet because I don't know where I can get this imagenet_less.zip file

Error screen

$ bash tools/benchmark.sh --benchmark_option=Performance --executor=TFLITE --target_abis=arm64-v8a
Starting local Bazel server and connecting to it...
........
INFO: Analysed target //aibench/python:benchmark (18 packages loaded).
INFO: Found 1 target...
Target //aibench/python:benchmark up-to-date:
  bazel-bin/aibench/python/benchmark
INFO: Elapsed time: 2.222s, Critical Path: 0.04s
INFO: 0 processes.
INFO: Build completed successfully, 1 total action
Find qualcomm adb device:711KPCA0776611
No Arm linux device yaml file
Prepare to run models on arm64-v8a
Push output/benchmark.pb to /data/local/tmp/aibench
Push output/model.pb to /data/local/tmp/aibench
Push output/TF_IV3_03.toco.tflite to /data/local/tmp/aibench
libhexagon_nn_skel.so does not exists, QualcommAdbDevice Skip DSP.
* Build //aibench/benchmark:model_benchmark for TFLITE with ABI arm64-v8a
WARNING: The following configs were expanded more than once: [cross_compile]. For repeatable flags, repeats are counted twice and may lead to unexpected behavior.
ERROR: build interrupted
INFO: Elapsed time: 56.532s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (8 packages loaded)
Traceback (most recent call last):
  File "/home/eric/src/mobile-ai-bench/bazel-bin/aibench/python/benchmark.runfiles/aibench/aibench/python/benchmark.py", line 354, in <module>
    main(unused_args=[sys.argv[0]] + unparsed)
  File "/home/eric/src/mobile-ai-bench/bazel-bin/aibench/python/benchmark.runfiles/aibench/aibench/python/benchmark.py", line 343, in main
    benchmark_option, benchmark_list, result_files,)
  File "/home/eric/src/mobile-ai-bench/bazel-bin/aibench/python/benchmark.runfiles/aibench/aibench/python/benchmark.py", line 261, in run_on_device
    avail_device_types)
  File "/home/eric/src/mobile-ai-bench/aibench/python/bench_engine.py", line 117, in bazel_build
    *bazel_args)
  File "/home/eric/.local/lib/python2.7/site-packages/sh.py", line 1413, in __call__
    raise exc
sh.ErrorReturnCode_8: 

  RAN: /home/eric/src/mobile-ai-bench/bazel build //aibench/benchmark:model_benchmark --config android --cpu=arm64-v8a --action_env=ANDROID_NDK_HOME=/home/eric/dev/android-ndk-r16b/ --define tflite=true

  STDOUT:


  STDERR:

The line that throws an exception is in sh.py:

        if call_args["fg"]:
            if call_args["env"] is None:
                launch = lambda: os.spawnv(os.P_WAIT, cmd[0], cmd)
            else:
                launch = lambda: os.spawnve(os.P_WAIT, cmd[0], cmd, call_args["env"])

            exit_code = launch()
            exc_class = get_exc_exit_code_would_raise(exit_code,
                    call_args["ok_code"], call_args["piped"])
            if exc_class:
                if IS_PY3:
                    ran = " ".join([arg.decode(DEFAULT_ENCODING, "ignore") for arg in cmd])
                else:
                    ran = " ".join(cmd)
                exc = exc_class(ran, b"", b"", call_args["truncate_exc"])
                raise exc    --------------------------> exception
            return None

Could you please help to solve this issue?

and.. one more question is... could you let me know where I can get or how I can create imagenet_less.zip?

Thanks a lot!

能支持nvidia相关平台么

你好:
我有一些问题想请教以下

1。是否可以根据Readme指导中,添加另外一种AI框架,来实现对nvidia支持
2。测试使用的这些模型,是跟公开的模型是完全一样的么,若,直接将这些模型在nvidia平台上推理,得到的推理时间是比较公平的么
3。若现在不支持的话,之后会支持相关的nvidia平台么

多谢

Caffe2 Support

Hi,

The repo is pretty awesome👍

Do you have plan to add Caffe2 to the benchmark?

Thanks!

com_google_protobuf Build Error

/private/var/tmp/_bazel_slice/4dad7a7745975e897b9323b66e817b04/external/com_google_protobuf/BUILD:355:1: Linking of rule '@com_google_protobuf//:protoc' failed (Exit 1): cc_wrapper.sh failed: error executing command

Kirin970 GPU much slower than Snapdragon 845

Are there any insights as to why kirin 970 GPU is that much slower than Snapdragon 845? The compute capabilities should be around the same for these two SoCs right?

For example mobilenetsv2 benchmark runs at ~10ms for sdm845 and 47.597ms for kirin970 (optimized). I also see big differences in my custom model. On a sdm845 I get around 75ms, while on kirin980 I get around 250ms.

Is it because snapdragon is actually that much faster, or because of how Mace ops / kernels are implemented? If it's the latter, what would be a good place to start working on possible optimizations?
Would you expect improvements if ARM Compute is used for ARM SoCs?

Which is fix-point, quant. or original model in bench

Thanks in advance. 🙇

I only found three quant. model below output directory as below:

root@cross-compile:/opt/mobile-ai-bench/output# ls
chairs_224x224.raw          inception_v3.tflite            mobilenet-v2.dlc          threads2
dog.npy                     keyboard_299x299.dat           mobilenet_v2.pb           threads4
inception_v3.data           libmace.zip                    prepare_report.csv        vgg16_caffe_gpu.data
inception_v3.dlc            mobilenet_quant_v1_224.tflite  run_report.csv            vgg16_caffe_gpu.pb
inception_v3_dsp.data       mobilenet_v1_1.0_224.tflite    squeezenet_v11.data       vgg16.data
inception_v3_dsp.pb         mobilenet_v1.data              squeezenet_v11.dlc        vgg16.dlc
inception_v3.param          mobilenet-v1.dlc               squeezenet_v11.pb         vgg16.pb
inception_v3.pb             mobilenet_v1.pb                tensorflow-1.9.0-rc1.zip  vgg16_quantized.dlc
inception_v3_quantized.dlc  mobilenet_v2.data              threads1
root@cross-compile:/opt/mobile-ai-bench/output# ls *quant*
inception_v3_quantized.dlc  mobilenet_quant_v1_224.tflite  vgg16_quantized.dlc
root@cross-compile:/opt/mobile-ai-bench/output#

SNPE problem about docs

我看SNPE也支持CPU的定点,其中文档有这么说:

Running CPU Fixed Point Runtime:
The CPU Fixed Point Runtime requires a quantized DLC and cannot convert a non-quantized DLC automatically. The quantization parameters in the DLC will be used for each output layer unless the layer is constrained to use the same input and output quantization parameters for speed and accuracy.

其中,这句的后半句,是啥意思,没看懂:The quantization parameters in the DLC will be used for each output layer unless the layer is constrained to use the same input and output quantization parameters for speed and accuracy.

  1. 这里output layer指的是最后的输出层,还是每层的输出?
  2. 后半句没看懂: the layer is constrained to use the same input and output quantization parameters for speed and accuracy.

HiAI file unavailable

http://cnbj1-fds.api.xiaomi.net/aibench/third_party/HiAI_DDK_100.200.010.011_LITE.zip

Unable to download HiAI DDK file

ERROR: /home/robert/Documents/mobile-ai-bench/aibench/executors/BUILD:156:1: no such package '@hiai//': Error downloading [http://cnbj1-fds.api.xiaomi.net/aibench/third_party/HiAI_DDK_100.200.010.011_LITE.zip] to /home/robert/.cache/bazel/_bazel_robert/a9476df2206ec84c4095a7e5440e4cc1/external/hiai/HiAI_DDK_100.200.010.011_LITE.zip: Unknown host: cnbj1-fds.api.xiaomi.net and referenced by '//aibench/executors:hiai_executor'
ERROR: Analysis of target '//aibench/benchmark:model_benchmark' failed; build aborted: Loading failed
INFO: Elapsed time: 1.043s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (2 packages loaded)

MACE framework,library "libcdsprpc.so" not found

python tools/benchmark.py --output_dir=output --frameworks=MACE --runtimes=CPU --model_names=MobileNetV1 --target_abis=armeabi-v7a

when run the cmd above, it errors on MACE, NCNN and SNPE framework are able to run successfully

('## make_output_processor ', <function process_output at 0x1042a4848>) ('cmd :', "cd /data/local/tmp/aibench; ADSP_LIBRARY_PATH='.;/system/lib/rfsa/adsp;/system/vendor/lib/rfsa/adsp;/dsp'; LD_LIBRARY_PATH=. ./model_benchmark") ('frameworks :', ['MACE']) ('MACE', 'CPU', 'MobileNetV1') WARNING: linker: ./model_benchmark: unused DT entry: type 0xf arg 0xa6a CANNOT LINK EXECUTABLE: library "libcdsprpc.so" not found page record for 0xf769503c was not found (block_size=16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.