XiaoMi / mobile-ai-bench

Benchmarking Neural Network Inference on Mobile Devices
Apache License 2.0
353 stars 57 forks source link

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

Open WangFengtu1996 opened 4 years ago

WangFengtu1996 commented 4 years ago

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.