PaddleOCR/test_tipc/docs/test_lite.md

72 lines
3.0 KiB
Markdown
Raw Normal View History

2021-10-27 15:34:28 +08:00
# Lite预测功能测试
Lite预测功能测试的主程序为`test_lite.sh`可以测试基于Lite预测库的模型推理功能。
## 1. 测试结论汇总
2021-10-28 16:24:03 +08:00
目前Lite端的样本间支持以方式的组合
2021-10-28 11:49:17 +08:00
**字段说明:**
- 输入设置包括C++预测、python预测、java预测
- 模型类型包括正常模型FP32和量化模型FP16
2021-10-28 18:42:39 +08:00
- batch-size包括1和4
2021-10-28 11:49:17 +08:00
- predictor数量包括多predictor预测和单predictor预测
- 功耗模式包括高性能模式LITE_POWER_HIGH和省电模式LITE_POWER_LOW
- 预测库来源:包括下载方式和编译方式,其中编译方式分为以下目标硬件:(1)ARM CPU;(2)Linux XPU;(3)OpenCL GPU;(4)Metal GPU
2021-10-28 18:50:49 +08:00
| 模型类型 | batch-size | predictor数量 | 功耗模式 | 预测库来源 | 支持语言 |
2021-10-28 18:52:29 +08:00
| :----: | :----: | :----: | :----: | :----: | :----: |
2021-10-28 18:50:49 +08:00
| 正常模型/量化模型 | 1 | 1 | 高性能模式/省电模式 | 下载方式 | C++预测 |
2021-10-27 15:34:28 +08:00
## 2. 测试流程
### 2.1 功能测试
2021-10-28 11:49:17 +08:00
先运行`prepare.sh`准备数据和模型模型和数据会打包到test_lite.tar中将test_lite.tar上传到手机上解压后进`入test_lite`目录中,然后运行`test_lite.sh`进行测试,最终在`test_lite/output`目录下生成`lite_*.log`后缀的日志文件。
2021-10-27 15:34:28 +08:00
```shell
# 数据和模型准备
bash test_tipc/prepare.sh ./test_tipc/configs/ppocr_det_mobile_params.txt "lite_infer"
# 手机端测试:
bash test_lite.sh ppocr_det_mobile_params.txt
```
2021-10-28 11:49:17 +08:00
**注意**由于运行该项目需要bash等命令传统的adb方式不能很好的安装。所以此处推荐通在手机上开启虚拟终端的方式连接电脑连接方式可以参考[安卓手机termux连接电脑](./termux_for_android.md)。
2021-10-27 15:34:28 +08:00
#### 运行结果
各测试的运行情况会打印在 `./output/` 中:
运行成功时会输出:
```
Run successfully with command - ./ocr_db_crnn det ./models/ch_ppocr_mobile_v2.0_det_slim_opt.nb INT8 4 1 LITE_POWER_LOW ./test_data/icdar2015_lite/text_localization/ch4_test_images/img_233.jpg ./config.txt True > ./output/lite_ch_ppocr_mobile_v2.0_det_slim_opt.nb_precision_INT8_batchsize_1_threads_4_powermode_LITE_POWER_LOW_singleimg_True.log 2>&1!
Run successfully with command xxx
...
```
运行失败时会输出:
```
Run failed with command - ./ocr_db_crnn det ./models/ch_ppocr_mobile_v2.0_det_slim_opt.nb INT8 4 1 LITE_POWER_LOW ./test_data/icdar2015_lite/text_localization/ch4_test_images/img_233.jpg ./config.txt True > ./output/lite_ch_ppocr_mobile_v2.0_det_slim_opt.nb_precision_INT8_batchsize_1_threads_4_powermode_LITE_POWER_LOW_singleimg_True.log 2>&1!
Run failed with command xxx
...
```
在./output/文件夹下会存在如下日志每一个日志都是不同配置下的log结果
<img src="lite_log.png" width="1000">
在每一个log中都会调用autolog打印如下信息
<img src="lite_auto_log.png" width="1000">
## 3. 更多教程
本文档为功能测试用更详细的Lite端预测使用教程请参考[Lite端部署](https://github.com/PaddlePaddle/PaddleOCR/blob/develop/deploy/lite/readme.md)。