PaddleOCR icon indicating copy to clipboard operation
PaddleOCR copied to clipboard

svtr+stn,inference和onnx模型推理精度差异很大

Open Acheerfulloser opened this issue 8 months ago • 4 comments

问题描述 / Problem Description

推理精度

运行环境 / Runtime Environment

  • OS:linux
  • cuda:11.2
  • python:3.7
  • Paddle:2.4.2.post112
  • PaddleOCR:2.6.1.0
  • paddle2onnx:1.0.6 / 1.1.0
  • onnxruntime:1.11.0

复现代码 / Reproduction Code

config文件: configs/rec/rec_svtrnet.yml

inference model: python tools/infer/predict_rec.py --image_dir="doc/pics/5.png" --rec_model_dir="./models/svtr_ch_all_stn" --rec_image_shape="3, 32, 480" --rec_char_dict_path="./ppocr/utils/labels.txt"

onnx model: python tools/infer/predict_rec.py --image_dir="doc/pics/5.png" --use_onnx=True --rec_model_dir="./models/svtr_ch_all_stn/inference.onnx" --rec_image_shape="3, 32, 480" --rec_char_dict_path="./ppocr/utils/labels.txt"

完整报错 / Complete Error Message

inference model: [2024/06/30 08:11:14] ppocr INFO: Predicts of doc/pics/5.png:(')pcHPJKOMNOPKGGHF)', 0.9971622824668884) onnx model: [2024/07/01 01:28:33] ppocr INFO: Predicts of doc/pics/5.png:('OG', 0.527418851852417)

可能解决方案 / Possible solutions

训练模型和推理模型输出精度损失在10e-8以内,但是转成onnx模型就在十分位或者百分位 尝试了模型库内的en_PP-OCRv3_rec_train infer分别转成onnx,结果都能对齐,说明环境没有问题 你们能提供一个stn+svtr的模型,可以发我测试一下精度吗?谢谢,随便都行,能测试精度就行

附件 / Appendix

Acheerfulloser avatar Jul 01 '24 02:07 Acheerfulloser