diff --git a/lite/demo/cxx/test_libs/README.md b/lite/demo/cxx/test_libs/README.md new file mode 100644 index 0000000000000000000000000000000000000000..06fa4613581966b1e1839bdabc89cb52ca25c0a2 --- /dev/null +++ b/lite/demo/cxx/test_libs/README.md @@ -0,0 +1,7 @@ +**测试PaddleLite C++预测库** + +1、编译full_publish预测库,需要打开build_extra,比如 `./lite/tools/build.sh --arm_os=android --arm_abi=armv8 --arm_lang=gcc --android_stl=c++_static --build_extra=ON full_publish` + +2、进入编译产出的目录,比如 `build.lite.android.armv8.gcc/inference_lite_lib.android.armv8/demo/cxx/test_libs`,执行 `sh prepare.sh`,得到所有测试文件在 `test_lite_lib_files` 文件中 + +3、将 `test_lite_lib_files` 文件push到手机上,进入手机端 `test_lite_lib_files` 目录,执行 `sh run.sh`,查看log信息统计测试结果,其中涵盖测试light库、full库、动态库和静态库。 diff --git a/lite/demo/cxx/test_libs/run.sh b/lite/demo/cxx/test_libs/run.sh index ead4c0adfaff1c3b44b9494d45277e365f6ff763..d5624e32e0d2c90aa17a3d13969dbdb6385c6d74 100644 --- a/lite/demo/cxx/test_libs/run.sh +++ b/lite/demo/cxx/test_libs/run.sh @@ -1,75 +1,76 @@ export LD_LIBRARY_PATH=$PWD/lite/lib/:${LD_LIBRARY_PATH} # mobilenetv1 +model_name="mobilenetv1" +input_params="--img_txt_path=models_imgs/images/classification.jpg.txt \ + --out_max_value=0.936887 \ + --out_max_value_index=65" +echo "Test ${model_name}: light_shared, light_static, full_shared, full_static." -./classification_light_shared \ - --optimized_model_path=models_imgs/models/mobilenetv1.nb \ - --img_txt_path=models_imgs/images/classification.jpg.txt \ - --out_max_value=0.936887 \ - --out_max_value_index=65 - -./classification_light_static \ - --optimized_model_path=models_imgs/models/mobilenetv1.nb \ - --img_txt_path=models_imgs/images/classification.jpg.txt \ - --out_max_value=0.936887 \ - --out_max_value_index=65 - -./classification_full_static \ - --model_dir=models_imgs/models/mobilenetv1 \ - --img_txt_path=models_imgs/images/classification.jpg.txt \ - --out_max_value=0.936887 \ - --out_max_value_index=65 - -./classification_full_shared \ - --model_dir=models_imgs/models/mobilenetv1 \ - --img_txt_path=models_imgs/images/classification.jpg.txt \ - --out_max_value=0.936887 \ - --out_max_value_index=65 +./classification_light_shared ${input_params} \ + --optimized_model_path=models_imgs/models/mobilenetv1.nb + +./classification_light_static ${input_params} \ + --optimized_model_path=models_imgs/models/mobilenetv1.nb + +./classification_full_shared ${input_params} \ + --model_dir=models_imgs/models/mobilenetv1 + +./classification_full_static ${input_params} \ + --model_dir=models_imgs/models/mobilenetv1 # mobilenetv2 +model_name="mobilenetv2" +input_params="--img_txt_path=models_imgs/images/classification.jpg.txt \ + --out_max_value=0.868888 \ + --out_max_value_index=65" +echo "Test ${model_name}: light_shared, light_static, full_shared, full_static." + +./classification_light_shared ${input_params} \ + --optimized_model_path=models_imgs/models/mobilenetv2.nb + +./classification_light_static ${input_params} \ + --optimized_model_path=models_imgs/models/mobilenetv2.nb + +./classification_full_shared ${input_params} \ + --model_dir=models_imgs/models/mobilenetv2 + +./classification_full_static ${input_params} \ + --model_dir=models_imgs/models/mobilenetv2 -./classification_light_shared \ - --optimized_model_path=models_imgs/models/mobilenetv2.nb \ - --img_txt_path=models_imgs/images/classification.jpg.txt \ - --out_max_value=0.868888 \ - --out_max_value_index=65 - -./classification_light_static \ - --optimized_model_path=models_imgs/models/mobilenetv2.nb \ - --img_txt_path=models_imgs/images/classification.jpg.txt \ - --out_max_value=0.868888 \ - --out_max_value_index=65 - -./classification_full_static \ - --model_dir=models_imgs/models/mobilenetv2 \ - --img_txt_path=models_imgs/images/classification.jpg.txt \ - --out_max_value=0.868888 \ - --out_max_value_index=65 - -./classification_full_shared \ - --model_dir=models_imgs/models/mobilenetv2 \ - --img_txt_path=models_imgs/images/classification.jpg.txt \ - --out_max_value=0.868888 \ - --out_max_value_index=65 +# shufflenetv2 +model_name="shufflenetv2" +input_params="--img_txt_path=models_imgs/images/classification.jpg.txt \ + --out_max_value=0.776729 \ + --out_max_value_index=65" +echo "Test ${model_name}: light_shared, light_static, full_shared, full_static." + +./classification_light_shared ${input_params} \ + --optimized_model_path=models_imgs/models/shufflenetv2.nb + +./classification_light_static ${input_params} \ + --optimized_model_path=models_imgs/models/shufflenetv2.nb + +./classification_full_shared ${input_params} \ + --model_dir=models_imgs/models/shufflenetv2 + +./classification_full_static ${input_params} \ + --model_dir=models_imgs/models/shufflenetv2 # yolov3 +model_name="yolov3" +input_params="--img_txt_path=models_imgs/images/yolov3.jpg.txt \ + --out_values=0,0.153605,174.494,199.729,562.075,604.014" +echo "Test ${model_name}: light_shared, light_static, full_shared, full_static." + +./yolov3_light_shared ${input_params} \ + --optimized_model_path=models_imgs/models/yolov3_mobilenetv1.nb + +./yolov3_light_static ${input_params} \ + --optimized_model_path=models_imgs/models/yolov3_mobilenetv1.nb + +./yolov3_full_shared ${input_params} \ + --model_dir=models_imgs/models/yolov3_mobilenetv1 -./yolov3_light_shared \ - --optimized_model_path=models_imgs/models/yolov3_mobilenetv1.nb \ - --img_txt_path=models_imgs/images/yolov3.jpg.txt \ - --out_values=0,0.153605,174.494,199.729,562.075,604.014 - -./yolov3_light_static \ - --optimized_model_path=models_imgs/models/yolov3_mobilenetv1.nb \ - --img_txt_path=models_imgs/images/yolov3.jpg.txt \ - --out_values=0,0.153605,174.494,199.729,562.075,604.014 - -./yolov3_full_static \ - --model_dir=models_imgs/models/yolov3_mobilenetv1 \ - --img_txt_path=models_imgs/images/yolov3.jpg.txt \ - --out_values=0,0.153605,174.494,199.729,562.075,604.014 - -./yolov3_full_shared \ - --model_dir=models_imgs/models/yolov3_mobilenetv1 \ - --img_txt_path=models_imgs/images/yolov3.jpg.txt \ - --out_values=0,0.153605,174.494,199.729,562.075,604.014 +./yolov3_full_static ${input_params} \ + --model_dir=models_imgs/models/yolov3_mobilenetv1