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.

2.5 KiB

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden 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.

Paddle2onnx预测功能测试

PaddleServing预测功能测试的主程序为test_paddle2onnx.sh可以测试Paddle2ONNX的模型转化功能并验证正确性。

1. 测试结论汇总

基于训练是否使用量化,进行本测试的模型可以分为正常模型量化模型这两类模型对应的Paddle2ONNX预测功能汇总如下

模型类型 device
正常模型 GPU
正常模型 CPU
量化模型 GPU
量化模型 CPU

2. 测试流程

2.1 功能测试

先运行prepare.sh准备数据和模型,然后运行test_paddle2onnx.sh进行测试,最终在test_tipc/output/{model_name}/paddle2onnx目录下生成paddle2onnx_infer_*.log后缀的日志文件。

bash test_tipc/prepare.sh ./test_tipc/configs/ch_PP-OCRv2_det/model_linux_gpu_normal_normal_paddle2onnx_python_linux_cpu.txt "paddle2onnx_infer"

# 用法:
bash test_tipc/test_paddle2onnx.sh ./test_tipc/configs/ch_PP-OCRv2_det/model_linux_gpu_normal_normal_paddle2onnx_python_linux_cpu.txt

运行结果

各测试的运行情况会打印在 test_tipc/output/{model_name}/paddle2onnx/results_paddle2onnx.log 中: 运行成功时会输出:

Run successfully with command - ch_PP-OCRv2_det -  paddle2onnx --model_dir=./inference/ch_PP-OCRv2_det_infer/ --model_filename=inference.pdmodel --params_filename=inference.pdiparams --save_file=./inference/det_v2_onnx/model.onnx --opset_version=10 --enable_onnx_checker=True!
Run successfully with command - ch_PP-OCRv2_det - python3.7 tools/infer/predict_det.py --use_gpu=True --image_dir=./inference/ch_det_data_50/all-sum-510/ --det_model_dir=./inference/det_v2_onnx/model.onnx --use_onnx=True > ./test_tipc/output/ch_PP-OCRv2_det/paddle2onnx/paddle2onnx_infer_gpu.log 2>&1 !
Run successfully with command - ch_PP-OCRv2_det - python3.7 tools/infer/predict_det.py --use_gpu=False --image_dir=./inference/ch_det_data_50/all-sum-510/ --det_model_dir=./inference/det_v2_onnx/model.onnx --use_onnx=True > ./test_tipc/output/ch_PP-OCRv2_det/paddle2onnx/paddle2onnx_infer_cpu.log 2>&1 !

运行失败时会输出:

Run failed with command - ch_PP-OCRv2_det -  paddle2onnx --model_dir=./inference/ch_PP-OCRv2_det_infer/ --model_filename=inference.pdmodel --params_filename=inference.pdiparams --save_file=./inference/det_v2_onnx/model.onnx --opset_version=10 --enable_onnx_checker=True!
...

3. 更多教程

本文档为功能测试用更详细的Paddle2onnx预测使用教程请参考Paddle2ONNX