TNN: developed by Tencent Youtu Lab and Guangying Lab, a uniform deep learning inference framework for mobile、desktop and server. TNN is distinguished by several outstanding features, including its cross-platform capability, high performance, model compression and code pruning. Based on ncnn and Rapidnet, TNN further strengthens the support and performance optimization for mobile devices, and also draws on the advantages of good extensibility and high performance from existed open source efforts. TNN has been deployed in multiple Apps from Tencent, such as Mobile QQ, Weishi, Pitu, etc. Contributions are welcome to work in collaborative with us and make TNN a better framework.
3. 编译方式(compile method)
cd benchmark/benchmark_android
./benchmark_models.sh
4. 编译日志(build log)
-- android-14 is unsupported. Using minimum supported version 16.
/home/zyb/TNN/TNN
/home/zyb/TNN/TNN
-- Found OpenMP_C: -fopenmp=libomp
-- Found OpenMP_CXX: -fopenmp=libomp
-- Found OpenMP: TRUE
-- >>>>>>>>>>>>>
-- TNN BUILD INFO:
-- System: Android
-- Processor: aarch64
-- Cpu: ON
-- X86: OFF
-- Arm: ON
-- Arm82: ON
-- Metal: OFF
-- OpenCL: ON
-- CUDA: OFF
-- DSP: OFF
-- Atlas: OFF
-- TensorRT: OFF
-- AppleNPU: OFF
-- HuaweiNPU:
-- RKNPU: OFF
-- OpenVINO: OFF
-- OpenMP: ON
-- TEST: ON
-- --Unit Test: OFF
-- Quantization: OFF
-- ModelCheck: OFF
-- DEBUG:
-- PROFILE: OFF
-- BENCHMARK: ON
-- BENCHMARK Layer: OFF
-- Model Converter: OFF
-- ONNX2TNN Converter: OFF
-- TNN2MEM: OFF
-- BENCHMARK Test Lib: ON
-- Dynamic Range Quantization: OFF
Generate OpenCL Source done !!!
-- Build TNN OpenCL
-- Configuring done
-- Generating done
-- Build files have been written to: /home/zyb/TNN/TNN/benchmark/benchmark_android/build
[ 5%] Built target TNNArm82
Scanning dependencies of target TNNOpenCL
[ 6%] Built target gflags_nothreads_static
[ 23%] Built target TNNCpu
[ 39%] Built target TNNArm
[ 39%] Building CXX object source/tnn/device/opencl/CMakeFiles/TNNOpenCL.dir/cl/opencl_program.cc.o
[ 53%] Built target TNNOpenCL
[ 53%] Linking CXX shared library libTNN.so
[ 98%] Built target TNN
[ 99%] Linking CXX executable TNNTest
[ 99%] Linking CXX shared library libTNNBenchmarkTest.so
[100%] Built target TNNTest
[100%] Built target TNNBenchmarkTest
-- android-14 is unsupported. Using minimum supported version 16.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/zyb/TNN/TNN/benchmark/benchmark_android/build/build_app
[ 50%] Linking CXX shared library libtnn_wrapper.so
[100%] Built target tnn_wrapper
Success
/home/zyb/TNN/TNN/benchmark/benchmark_android/../benchmark-model/: 17 files pushed. 6.9 MB/s (269828 bytes in 0.037s)
./build_app/libtnn_wrapper.so: 1 file pushed. 37.0 MB/s (470248 bytes in 0.012s)
./test/libTNNBenchmarkTest.so: 1 file pushed. 59.0 MB/s (223368 bytes in 0.004s)
./libTNN.so: 1 file pushed. 91.3 MB/s (6306928 bytes in 0.066s)
benchmark device: ARM
Stopping: com.tencent.tnn.benchmark
Starting: Intent { cmp=com.tencent.tnn.benchmark/.MainActivity (has extras) }
Status: ok
Activity: com.tencent.tnn.benchmark/.MainActivity
ThisTime: 457
TotalTime: 16428
WaitTime: 488
Complete
04-29 16:28:51.095 22242 22242 I tnn : void tnn::test::Timer::Print() [File /home/zyb/TNN/TNN/test/timer.cc][Line 60] shufflenet_v2.tnnproto - ARM TNN Benchmark time cost: min = 2.464 ms | max = 3.019 ms | avg = 2.664 ms
Stopping: com.tencent.tnn.benchmark
Starting: Intent { cmp=com.tencent.tnn.benchmark/.MainActivity (has extras) }
Status: ok
Activity: com.tencent.tnn.benchmark/.MainActivity
ThisTime: 475
TotalTime: 475
WaitTime: 496
Complete
04-29 16:28:58.025 22312 22312 I tnn : void tnn::test::Timer::Print() [File /home/zyb/TNN/TNN/test/timer.cc][Line 60] squeezenet_v1.1.tnnproto - ARM TNN Benchmark time cost: min = 7.568 ms | max = 7.700 ms | avg = 7.654 ms
Stopping: com.tencent.tnn.benchmark
Starting: Intent { cmp=com.tencent.tnn.benchmark/.MainActivity (has extras) }
**5. 详细描述bug 情况 (Describe the bug)**
相关环境:
android-ndk-r21-linux-x86_64
测试手机型号 ZTE Axon 10 pro
[模型下载link](https://pan.baidu.com/s/1SZvNqiNofyF664o9ioibDg)
提取吗:edw5
里面的onnx文件是我的模型,posenet_tnn保存的是我转换之后的模型
转换命令为`python onnx2tnn.py ../../../../posenetv33_8x.onnx -version=v1.0 -optimize=1 -half=0 -o ../../../../posenet_tnn/`
在benchmark_models.sh里面添加我的模型
`benchmark_model_list=(
#test.tnnproto \
shufflenet_v2.tnnproto \
squeezenet_v1.1.tnnproto \
posenetv33_8x.opt.tnnproto
)`
随后运行./benchmark_models.sh -c或者./benchmark_models.sh
测试shufflenetv2和squeezenet_v1.1都没有问题,在测试posenetv33时候发生卡住,没有任何反应(Starting: Intent { cmp=com.tencent.tnn.benchmark/.MainActivity (has extras) }),停在这句话上
**6. 运行日志(runtime log)**
```txt
/home/zyb/TNN/TNN/benchmark/benchmark_android/../benchmark-model/: 17 files pushed. 6.9 MB/s (269828 bytes in 0.037s)
./build_app/libtnn_wrapper.so: 1 file pushed. 37.0 MB/s (470248 bytes in 0.012s)
./test/libTNNBenchmarkTest.so: 1 file pushed. 59.0 MB/s (223368 bytes in 0.004s)
./libTNN.so: 1 file pushed. 91.3 MB/s (6306928 bytes in 0.066s)
benchmark device: ARM
Stopping: com.tencent.tnn.benchmark
Starting: Intent { cmp=com.tencent.tnn.benchmark/.MainActivity (has extras) }
Status: ok
Activity: com.tencent.tnn.benchmark/.MainActivity
ThisTime: 457
TotalTime: 16428
WaitTime: 488
Complete
04-29 16:28:51.095 22242 22242 I tnn : void tnn::test::Timer::Print() [File /home/zyb/TNN/TNN/test/timer.cc][Line 60] shufflenet_v2.tnnproto - ARM TNN Benchmark time cost: min = 2.464 ms | max = 3.019 ms | avg = 2.664 ms
Stopping: com.tencent.tnn.benchmark
Starting: Intent { cmp=com.tencent.tnn.benchmark/.MainActivity (has extras) }
Status: ok
Activity: com.tencent.tnn.benchmark/.MainActivity
ThisTime: 475
TotalTime: 475
WaitTime: 496
Complete
04-29 16:28:58.025 22312 22312 I tnn : void tnn::test::Timer::Print() [File /home/zyb/TNN/TNN/test/timer.cc][Line 60] squeezenet_v1.1.tnnproto - ARM TNN Benchmark time cost: min = 7.568 ms | max = 7.700 ms | avg = 7.654 ms
Stopping: com.tencent.tnn.benchmark
Starting: Intent { cmp=com.tencent.tnn.benchmark/.MainActivity (has extras) }
1. 环境(environment)
RunTime DEVICE: ARM/OPENCL
2. Github版本
commit(optional): 9766eeedb2734cb5231
3. 编译方式(compile method) cd benchmark/benchmark_android ./benchmark_models.sh
4. 编译日志(build log)
-- Build TNN OpenCL -- Configuring done -- Generating done -- Build files have been written to: /home/zyb/TNN/TNN/benchmark/benchmark_android/build [ 5%] Built target TNNArm82 Scanning dependencies of target TNNOpenCL [ 6%] Built target gflags_nothreads_static [ 23%] Built target TNNCpu [ 39%] Built target TNNArm [ 39%] Building CXX object source/tnn/device/opencl/CMakeFiles/TNNOpenCL.dir/cl/opencl_program.cc.o [ 53%] Built target TNNOpenCL [ 53%] Linking CXX shared library libTNN.so [ 98%] Built target TNN [ 99%] Linking CXX executable TNNTest [ 99%] Linking CXX shared library libTNNBenchmarkTest.so [100%] Built target TNNTest [100%] Built target TNNBenchmarkTest -- android-14 is unsupported. Using minimum supported version 16. -- Configuring done -- Generating done -- Build files have been written to: /home/zyb/TNN/TNN/benchmark/benchmark_android/build/build_app [ 50%] Linking CXX shared library libtnn_wrapper.so [100%] Built target tnn_wrapper Success /home/zyb/TNN/TNN/benchmark/benchmark_android/../benchmark-model/: 17 files pushed. 6.9 MB/s (269828 bytes in 0.037s) ./build_app/libtnn_wrapper.so: 1 file pushed. 37.0 MB/s (470248 bytes in 0.012s) ./test/libTNNBenchmarkTest.so: 1 file pushed. 59.0 MB/s (223368 bytes in 0.004s) ./libTNN.so: 1 file pushed. 91.3 MB/s (6306928 bytes in 0.066s)
benchmark device: ARM
Stopping: com.tencent.tnn.benchmark Starting: Intent { cmp=com.tencent.tnn.benchmark/.MainActivity (has extras) } Status: ok Activity: com.tencent.tnn.benchmark/.MainActivity ThisTime: 457 TotalTime: 16428 WaitTime: 488 Complete 04-29 16:28:51.095 22242 22242 I tnn : void tnn::test::Timer::Print() [File /home/zyb/TNN/TNN/test/timer.cc][Line 60] shufflenet_v2.tnnproto - ARM TNN Benchmark time cost: min = 2.464 ms | max = 3.019 ms | avg = 2.664 ms Stopping: com.tencent.tnn.benchmark Starting: Intent { cmp=com.tencent.tnn.benchmark/.MainActivity (has extras) } Status: ok Activity: com.tencent.tnn.benchmark/.MainActivity ThisTime: 475 TotalTime: 475 WaitTime: 496 Complete 04-29 16:28:58.025 22312 22312 I tnn : void tnn::test::Timer::Print() [File /home/zyb/TNN/TNN/test/timer.cc][Line 60] squeezenet_v1.1.tnnproto - ARM TNN Benchmark time cost: min = 7.568 ms | max = 7.700 ms | avg = 7.654 ms Stopping: com.tencent.tnn.benchmark Starting: Intent { cmp=com.tencent.tnn.benchmark/.MainActivity (has extras) }
7. 截图(Screenshots)