Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
stringency opened this issue May 19, 2024 · 8 comments
Labels
Bug Something isn't working PaddleOCR

Comments

@stringency
Copy link

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

  • 系统环境/System Environment:python3.10.4
  • 版本号/Version:Paddle: PaddleOCR: 问题相关组件/Related components:
    paddle2onnx 1.0.6
    paddlepaddle 2.5.2
    paddleslim 2.6.0
  • 运行指令/Command Code:
  • 微调量化onnx部署

python tools/infer/predict_system.py --use_onnx=True --use_gpu=False --det_model_dir=output/CCPD/det_quant/onnx/model.onnx --rec_model_dir=output/CCPD/rec_quant/onnx/model.onnx --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

  • 完整报错/Complete Error Message:
    [2024/05/18 02:21:46] 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:21:46] ppocr DEBUG: dt_boxes num : 0, elapsed : 0.13833069801330566
    [2024/05/18 02:21:46] ppocr DEBUG: rec_res num : 0, elapsed : 0.0
    [2024/05/18 02:21:46] 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.141s
    [2024/05/18 02:21:46] 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:21:46] ppocr INFO: The predict total time is 0.1968538761138916
@stringency
Copy link
Author

stringency commented May 19, 2024

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

飞桨模型非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

@Zheng-Bicheng Zheng-Bicheng added Bug Something isn't working PaddleOCR labels May 22, 2024
@jzhang533 jzhang533 changed the title 量化的飞浆模型部署正常,但是转化为onnx模型出现问题(非量化的模型转为onnx可以正常部署) 量化的飞桨模型部署正常,但是转化为onnx模型出现问题(非量化的模型转为onnx可以正常部署) May 24, 2024
@Zheng-Bicheng
Copy link
Collaborator

幸苦提供一下量化以后的PaddleOCR模型,我这边测试一下

@stringency
Copy link
Author

幸苦提供一下量化以后的PaddleOCR模型,我这边测试一下

output/CCPD/det_quant/onnx/model.onnx:
det_quant_model.zip

output/CCPD/rec_quant/onnx/model.onnx:
rec_quant_model.zip

@Homura852
Copy link

你好,请问你在将检测模型进行量化训练时,训练速度如何呢?为什么我这边正常训练模型速度很快,但是转为量化训练就会慢很多。

Copy link

This issue is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale label Dec 11, 2024
@stringency
Copy link
Author

stringency commented Dec 11, 2024 via email

@github-actions github-actions bot removed the stale label Dec 12, 2024
Copy link

This issue is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale label Jan 12, 2025
@stringency
Copy link
Author

stringency commented Jan 12, 2025 via email

@github-actions github-actions bot removed the stale label Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working PaddleOCR
Projects
None yet
Development

No branches or pull requests

3 participants