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

ppocr模型转换bmodel精度不一致 #81

Open
anyu5733 opened this issue Dec 31, 2024 · 1 comment
Open

ppocr模型转换bmodel精度不一致 #81

anyu5733 opened this issue Dec 31, 2024 · 1 comment

Comments

@anyu5733
Copy link

请问教程中的模型,是使用ppocr v2.8版本的哪一个配置文件训练的呢?
使用scripts/download.sh脚本中下载的models/paddle/ch_PP-OCRv4_det_infer/ 根据官网步骤转化后,与下载的bmodel精度一致。
但是我使用百度提供的ch_PP-OCRv4_det_student.yml配置文件训练自己的模型后,转换的onnx与bmodel精度不一致,bmodel差很多。

附转换脚本:
1.paddle训练模型转换推理模型
python3 tools/export_model.py -c configs/det/ch_PP-OCRv4/ch_PP-OCRv4_det_student.yml -o Global.pretrained_model=./output/ch_PP-OCRv4/best_accuracy Global.save_inference_dir=./output/
2.推理模型转换onnx
paddle2onnx --model_dir ./output/
--model_filename inference.pdmodel
--params_filename inference.pdiparams
--save_file ppocrv4_det.onnx
--opset_version 14
--enable_onnx_checker True
3.转换bmodel
gen_fp32bmodel_mlir.sh 只修改了 18 24 30行三个 --model_def 参数

@sophon-leevi
Copy link
Collaborator

是det还是rec模型出现精度问题?可以参考mlir的文档在转模型的时候加个精度比对试试。model_transform加--test_input和--test_result,如果是图片要加预处理参数如--mean --scale等。model_deploy加--test_input和--test_reference。
https://doc.sophgo.com/sdk-docs/v24.04.01/docs_latest_release/docs/tpu-mlir/developer_manual/html/03_user_interface.html#model-transform-py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants