You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3.8 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

Lite_arm_cpp预测功能测试

Lite_arm_cpp预测功能测试的主程序为test_lite_arm_cpp.sh可以在ARM上基于Lite预测库测试模型的C++推理功能。

1. 测试结论汇总

目前Lite端的样本间支持以方式的组合

字段说明:

  • 模型类型包括正常模型FP32和量化模型INT8
  • batch-size包括1和4
  • threads包括1和4
  • predictor数量包括单predictor预测和多predictor预测
  • 预测库来源:包括下载方式和编译方式
  • 测试硬件ARM_CPU/ARM_GPU_OPENCL
模型类型 batch-size threads predictor数量 预测库来源 测试硬件
正常模型/量化模型 1 1/4 单/多 下载方式/编译方式 ARM_CPU/ARM_GPU_OPENCL

2. 测试流程

运行环境配置请参考文档的内容配置TIPC的运行环境。

2.1 功能测试

先运行prepare_lite_cpp.sh,运行后会在当前路径下生成test_lite.tar,其中包含了测试数据、测试模型和用于预测的可执行文件。将test_lite.tar上传到被测试的手机上,在手机的终端解压该文件,进入test_lite目录中,然后运行test_lite_arm_cpp.sh进行测试,最终在test_lite/output目录下生成lite_*.log后缀的日志文件。

2.1.1 基于ARM_CPU测试


# 数据、模型、Paddle-Lite预测库准备
#预测库为下载方式
bash test_tipc/prepare_lite_cpp.sh ./test_tipc/configs/ch_PP-OCRv2_det/model_linux_gpu_normal_normal_lite_cpp_arm_cpu.txt download
#预测库为编译方式
bash test_tipc/prepare_lite_cpp.sh ./test_tipc/configs/ch_PP-OCRv2_det/model_linux_gpu_normal_normal_lite_cpp_arm_cpu.txt compile

# 手机端测试:
bash test_lite_arm_cpp.sh model_linux_gpu_normal_normal_lite_cpp_arm_cpu.txt

2.1.2 基于ARM_GPU_OPENCL测试


# 数据、模型、Paddle-Lite预测库准备
#预测库下载方式
bash test_tipc/prepare_lite_cpp.sh ./test_tipc/configs/ch_PP-OCRv2_det/model_linux_gpu_normal_normal_lite_cpp_arm_gpu_opencl.txt download
#预测库编译方式
bash test_tipc/prepare_lite_cpp.sh ./test_tipc/configs/ch_PP-OCRv2_det/model_linux_gpu_normal_normal_lite_cpp_arm_gpu_opencl.txt compile

# 手机端测试:
bash test_lite_arm_cpp.sh model_linux_gpu_normal_normal_lite_cpp_arm_gpu_opencl.txt

注意

由于运行该项目需要bash等命令传统的adb方式不能很好的安装。所以此处推荐通在手机上开启虚拟终端的方式连接电脑连接方式可以参考安卓手机termux连接电脑

2.2 运行结果

各测试的运行情况会打印在 ./output/ 中: 运行成功时会输出:

Run successfully with command - ./ocr_db_crnn det ch_PP-OCRv2_det_infer_opt.nb ARM_CPU FP32 1 1  ./test_data/icdar2015_lite/text_localization/ch4_test_images/ ./config.txt True > ./output/lite_ch_PP-OCRv2_det_infer_opt.nb_runtime_device_ARM_CPU_precision_FP32_batchsize_1_threads_1.log 2>&1!
Run successfully with command xxx
...

运行失败时会输出:

Run failed with command - ./ocr_db_crnn det ch_PP-OCRv2_det_infer_opt.nb ARM_CPU FP32 1 1  ./test_data/icdar2015_lite/text_localization/ch4_test_images/ ./config.txt True > ./output/lite_ch_PP-OCRv2_det_infer_opt.nb_runtime_device_ARM_CPU_precision_FP32_batchsize_1_threads_1.log 2>&1!
Run failed with command xxx
...

在./output/文件夹下会存在如下日志每一个日志都是不同配置下的log结果

在每一个log中都会调用autolog打印如下信息

3. 更多教程

本文档为功能测试用更详细的Lite端预测使用教程请参考Lite端部署