PaddlePaddle / PaddleOCR

Awesome multilingual OCR toolkits based on PaddlePaddle (practical ultra lightweight OCR system, support 80+ languages recognition, provide data annotation and synthesis tools, support training and deployment among server, mobile, embedded and IoT devices)
https://paddlepaddle.github.io/PaddleOCR/
Apache License 2.0
42.57k stars 7.67k forks source link

量化的飞浆模型部署正常,但是转化为onnx模型出现问题(非量化的模型转为onnx可以正常部署) #12139

Closed stringency closed 3 months ago

stringency commented 3 months ago

请提供下述完整信息以便快速定位问题/Please provide the following information to quickly locate the problem

stringency commented 3 months ago

为了对比我提供飞浆模型的运行结果

飞浆模型非onnx模型的微调量化部署

python tools/infer/predict_system.py --det_model_dir=output/CCPD/det_quant/infer/ --rec_model_dir=output/CCPD/rec_quant/infer/ --image_dir="F:/DataSet/CCPD2020/ccpd_green/test/04131106321839081-92_258-159&509_530&611-527&611_172&599_159&509_530&525-0_0_3_32_30_31_30_30-109-106.jpg" --rec_image_shape=3,48,320

运行结果

[2024/05/18 02:34:52] ppocr INFO: In PP-OCRv3, rec_image_shape parameter defaults to '3, 48, 320', if you are using recognition model with PP-OCRv2 or an older version, please set --rec_image_shape='3,32,320 [2024/05/18 02:34:52] ppocr DEBUG: dt_boxes num : 1, elapsed : 0.12008166313171387 [2024/05/18 02:34:52] ppocr DEBUG: rec_res num : 1, elapsed : 0.008484840393066406 [2024/05/18 02:34:52] ppocr DEBUG: 0 Predict time of F:/DataSet/CCPD2020/ccpd_green/test/04131106321839081-92_258-159&509_530&611-527&611_172&599_159&509_530&525-0_0_3_32_30_31_30_30-109-106.jpg: 0.133s rec_image_shape=3,48,320 E0518 02:37:38.138892 5744 analysis_config.cc:121] Please use PaddlePaddle with GPU version. E0518 02:37:38.592444 5744 analysis_config.cc:121] Please use PaddlePaddle with GPU version. [2024/05/18 02:37:38] ppocr INFO: In PP-OCRv3, rec_image_shape parameter defaults to '3, 48, 320', if you are using recognition model with PP-OCRv2 or an older version, please set --rec_image_shape='3,32,320 [2024/05/18 02:37:39] ppocr DEBUG: dt_boxes num : 1, elapsed : 1.078622579574585 [2024/05/18 02:37:40] ppocr DEBUG: rec_res num : 1, elapsed : 0.1730790138244629 [2024/05/18 02:37:40] ppocr DEBUG: 0 Predict time of F:/DataSet/CCPD2020/ccpd_green/test/04131106321839081-92_258-159&509_530&611-527&611_172&599_159&509_530&525-0_0_3_32_30_31_30_30-109-106.jpg: 1.254s [2024/05/18 02:37:40] ppocr DEBUG: 皖AD867660, 0.873 [2024/05/18 02:37:40] ppocr DEBUG: The visualized image saved in ./inference_results\04131106321839081-92_258-159&509_530&611-527&611_172&599_159&509_530&525-0_0_3_32_30_31_30_30-109-106.jpg [2024/05/18 02:37:40] ppocr INFO: The predict total time is 1.304152488708496

SWHL commented 3 months ago

这个应该是paddle2onnx转换问题。之前试过,paddle2onnx不支持转换量化后的模型的。 建议去Paddle2ONNX issue寻找解决方案