PaddlePaddle / Paddle2ONNX

ONNX Model Exporter for PaddlePaddle
Apache License 2.0
672 stars 156 forks source link

PaddleOCR转ONNX问题 #334

Open RyanCCC opened 2 years ago

RyanCCC commented 2 years ago

请问如何将https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_server_v2.0_rec_infer.tar转换成ONNX模型?

之前也有issue:https://github.com/PaddlePaddle/Paddle2ONNX/issues/248提到,能否给出具体步骤?小白表示看不懂,谢谢

yeliang2258 commented 2 years ago

Please use the following command:

paddle2onnx --model_dir ./  --model_filename inference.pdmodel --params_filename inference.pdiparams --save_file model.onnx --opset_version 10 --enable_onnx_checker True
RyanCCC commented 2 years ago

Please use the following command:

paddle2onnx --model_dir ./  --model_filename inference.pdmodel --params_filename inference.pdiparams --save_file model.onnx --opset_version 10 --enable_onnx_checker True

image

请问怎么把pre-trained model 转换成inference model,然后再把inference model转换成onnx?因为官网给出的ch_ppocr_server_v2.0_xx不支持动态尺度。

yeliang2258 commented 2 years ago

您好,paddleOCR的Repo中有模型导出的脚本,可以加载权重参数,然后导出成inference model,最后再用paddle2onnx进行模型转换。 paddleOCR模型导出问题请参考:https://github.com/PaddlePaddle/PaddleOCR

RyanCCC commented 2 years ago

您好,paddleOCR的Repo中有模型导出的脚本,可以加载权重参数,然后导出成inference model,最后再用paddle2onnx进行模型转换。 paddleOCR模型导出问题请参考:https://github.com/PaddlePaddle/PaddleOCR

是的,我昨天试过用tools\export_model.py转过,但是不成功,能否指导一下?非常感谢!

类似的命令:


# -c Set the training algorithm yml configuration file
# -o Set optional parameters
# Global.pretrained_model parameter Set the training model address to be converted without adding the file suffix .pdmodel, .pdopt or .pdparams.
# Global.save_inference_dir Set the address where the converted model will be saved.

python3 tools/export_model.py -c configs/rec/ch_ppocr_v2.0/rec_chinese_lite_train_v2.0.yml -o Global.pretrained_model=./ch_lite/ch_ppocr_mobile_v2.0_rec_train/best_accuracy  Global.save_inference_dir=./inference/rec_crnn/
yeliang2258 commented 2 years ago

您好,paddleOCR的Repo中有模型导出的脚本,可以加载权重参数,然后导出成inference model,最后再用paddle2onnx进行模型转换。 paddleOCR模型导出问题请参考:https://github.com/PaddlePaddle/PaddleOCR

是的,我昨天试过用tools\export_model.py转过,但是不成功,能否指导一下?非常感谢!

类似的命令:

# -c Set the training algorithm yml configuration file
# -o Set optional parameters
# Global.pretrained_model parameter Set the training model address to be converted without adding the file suffix .pdmodel, .pdopt or .pdparams.
# Global.save_inference_dir Set the address where the converted model will be saved.

python3 tools/export_model.py -c configs/rec/ch_ppocr_v2.0/rec_chinese_lite_train_v2.0.yml -o Global.pretrained_model=./ch_lite/ch_ppocr_mobile_v2.0_rec_train/best_accuracy  Global.save_inference_dir=./inference/rec_crnn/

您好,为了更快更专业的解决你的问题,您可以直接到paddleOCR下面提issue