From 0b15238cc388b6de9cd9e8f5129260b0a19336e3 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 7 Aug 2020 16:38:01 +0800 Subject: [PATCH] add for new nets --- mindspore/lite/test/models_tflite.cfg | 27 ++++++++++++++++++++ mindspore/lite/test/run_benchmark_nets.sh | 31 ++++++++++++++++------- 2 files changed, 49 insertions(+), 9 deletions(-) create mode 100644 mindspore/lite/test/models_tflite.cfg diff --git a/mindspore/lite/test/models_tflite.cfg b/mindspore/lite/test/models_tflite.cfg new file mode 100644 index 0000000000..3b1c19d489 --- /dev/null +++ b/mindspore/lite/test/models_tflite.cfg @@ -0,0 +1,27 @@ +hiai_model_0909_kd_rot_ps_softmax.tflite +hiai_chinese_english_recognize_model_float32.tflite +hiai_bigmodel_ghost_2_1_no_normalized_no_trans_tflite.tflite +hiai_bigmodel_ghost_5_1_no_normalized_no_trans_tflite.tflite +hiai_cn_recognize_modify_padv2.tflite +hiai_model_normalize_object_scene_ps_20200519.tflite +hiai_detectmodel_06_23_960_480_1180700.tflite +hiai_detect_curve_model_float32.tflite +hiai_detectmodel_desnet_256_128_64_32.tflite +mtk_AADB_HADB_MBV3_model_fp32.tflite +mobilenet_v1_0.25_128.tflite +mobilenet_v1_0.25_160.tflite +mobilenet_v1_0.25_192.tflite +mobilenet_v1_0.25_224.tflite +mobilenet_v1_0.5_128.tflite +mobilenet_v1_0.5_160.tflite +mobilenet_v1_0.5_192.tflite +mobilenet_v1_0.5_224.tflite +mobilenet_v1_0.75_128.tflite +mobilenet_v1_0.75_160.tflite +mobilenet_v1_0.75_192.tflite +mobilenet_v1_0.75_224.tflite +mobilenet_v1_1.0_128.tflite +mobilenet_v1_1.0_160.tflite +mobilenet_v1_1.0_192.tflite +mobilenet_v1_1.0_224.tflite +mobilenet_v2_1.0_224.tflite diff --git a/mindspore/lite/test/run_benchmark_nets.sh b/mindspore/lite/test/run_benchmark_nets.sh index e1dd9d5380..61f88b21ba 100644 --- a/mindspore/lite/test/run_benchmark_nets.sh +++ b/mindspore/lite/test/run_benchmark_nets.sh @@ -1,4 +1,6 @@ #!/bin/bash +basepath=$(pwd) +echo $basepath set -e #example:sh run_benchmark_nets.sh -a /home/temp_test -c /home/temp_test -m /home/temp_test/models -d "8KE5T19620002408" while getopts "a:c:m:d:" opt @@ -26,6 +28,8 @@ do esac done + + #unzip arm cd $arm_path tar -zxf MSLite-*-linux_arm64.tar.gz @@ -44,25 +48,32 @@ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib/:./third_party/protobuf/lib #convert the models cd $convertor_path/MSLite-*-linux_x86_64 -models_config_filename=/home/workspace/mindspore_dataset/mslite/models/models_config.txt +#models_config_filename=/home/workspace/mindspore_dataset/mslite/models/models_config.txt +models_tflite_config=${basepath}/models_tflite.cfg +mkdir -p ${basepath}/ms_models +ms_models_path=${basepath}/ms_models while read line;do model_name=$line - ./converter_lite --fmk=TFLITE --modelFile=$models_path/${model_name} --outputFile=$models_path/${model_name} -done < ${models_config_filename} + echo $model_name + echo './converter_lite --fmk=TFLITE --modelFile='${models_path}'/'${model_name}' --outputFile='${ms_models_path}'/'${model_name}'' + ./converter_lite --fmk=TFLITE --modelFile=$models_path/${model_name} --outputFile=${ms_models_path}/${model_name} +done < ${models_tflite_config} #push to the arm and run benchmark: #first:copy to the server which connected to the phone -mkdir -p ./benchmark_test -cp $arm_path/MSLite-0.6.0-linux_arm64/lib/libmindspore-lite.so ./benchmark_test/libmindspore-lite.so -cp $arm_path/MSLite-0.6.0-linux_arm64/benchmark/benchmark ./benchmark_test/benchmark +mkdir -p ${basepath}/benchmark_test +benchmark_test_path=${basepath}/benchmark_test +cd ${benchmark_test_path} +cp $arm_path/MSLite-0.6.0-linux_arm64/lib/libmindspore-lite.so ${benchmark_test_path}/libmindspore-lite.so +cp $arm_path/MSLite-0.6.0-linux_arm64/benchmark/benchmark ${benchmark_test_path}/benchmark #copy the models: -cp $models_path/*.ms ./benchmark_test/ +cp ${ms_models_path}/*.ms ${benchmark_test_path} #second:adb push to the phone -adb -s $device_id push ./benchmark_test /data/local/tmp/ +adb -s $device_id push ${benchmark_test_path} /data/local/tmp/ #third:run adb ,run session ,check the result: echo 'cd /data/local/tmp/benchmark_test' > adb_cmd.txt @@ -71,8 +82,10 @@ echo 'chmod 777 benchmark' >> adb_cmd.txt #run models: while read line;do model_name=$line + echo $model_name + echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --modelPath='${model_name}'.ms --inDataPath=/data/local/tmp/input_output/input/'${model_name}'.ms.bin --calibDataPath=/data/local/tmp/input_output/output/'${model_name}'.ms.out --warmUpLoopCount=1 --loopCount=1' echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --modelPath='${model_name}'.ms --inDataPath=/data/local/tmp/input_output/input/'${model_name}'.ms.bin --calibDataPath=/data/local/tmp/input_output/output/'${model_name}'.ms.out --warmUpLoopCount=1 --loopCount=1' >> adb_cmd.txt -done < ${models_config_filename} +done < ${models_tflite_config} adb -s $device_id shell < adb_cmd.txt