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

[doc] fixing broken links and updating paddle2onnx usage descriptions #12749

Merged
merged 7 commits into from
Jun 9, 2024

Conversation

Mrxuba
Copy link
Contributor

@Mrxuba Mrxuba commented Jun 6, 2024

  • docs: 修复了deploy/paddle2onnx/readme_ch中[模型导出说明]文件中文版链接不存在的问题,doc/doc_en/inference_en.md为base翻译中文版模型导出说明
  • docs: 添加了对于Paddle2ONNX模型转化中选项--input_shape_dict的解释说明与解决方法

@CLAassistant
Copy link

CLAassistant commented Jun 6, 2024

CLA assistant check
All committers have signed the CLA.

@Mrxuba Mrxuba closed this Jun 6, 2024
@Mrxuba Mrxuba reopened this Jun 6, 2024
@GreatV GreatV requested review from jzhang533 and GreatV June 6, 2024 03:18
@GreatV GreatV changed the title [docs]:修复了deploy/paddle2onnx/readme_ch中[模型导出说明]文件中文版链接不存在的问题,doc/doc_en/inference_en.md为base翻译中文版模型导出说明 [docs]:添加了对于Paddle2ONNX模型转化中选项--input_shape_dict的解释说明与解决方法 [doc] fixing broken links and updating paddle2onnx usage descriptions Jun 6, 2024
doc/doc_ch/inference_ch.md Outdated Show resolved Hide resolved
@@ -88,6 +88,32 @@ paddle2onnx --model_dir ./inference/ch_ppocr_mobile_v2.0_cls_infer \
另外,以下几个模型暂不支持转换为 ONNX 模型:
NRTR、SAR、RARE、SRN

* 注意:[当前版本(v2.7.5)](https://github.com/PaddlePaddle/PaddleOCR/releases/tag/v2.7.5)现已不支持动态shape,即动态选项--input_shape_dict="{'x': [-1, 3, -1, -1]}",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里应该用paddle2onnx的版本

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感谢您的反馈,但是我注意到在PaddlePaddle版本号小于等于2.5.0时可以正常使用PaddleUtils命令修改--input_shape_dict
这里是我的库更新情况:
image

当我使用2.5.0的paddlepaddle时可以正常执行,原因如下
image

另外对于paddle2onnx的版本都出现了相同的错误情况,因此这里并没有提到这里应该用paddle2onnx的版本。
目前我使用的paddle2onnx版本为1.0.0

如果需要任何详细信息,请联系我

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

原因是因为
https://github.com/PaddlePaddle/Paddle/releases
新版本的paddlepaddle不再兼容paddle.fluid API,但是PaddleUtils仍在进行使用,因此如果使用PaddleUtils进行shape修改需要使用旧版paddlepaddle
image

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

或许可以使用onnxsim来实现动态shape

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

文档里要兼容最新的paddlepaddle

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

但这些都跟paddleocr的版本无关

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是的,paddleocr的版本不需要进行修改

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

或许可以使用onnxsim来实现动态shape

我会再次进行尝试

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里应该是新版的paddle2onnx不支持修改输入尺寸,而不是paddleocr不支持,这里跟paddleocr无关。

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同时也不需要修改shape为-1,因为原本的shape的就是动态的float32[p2o.DynamicDimension.0,3,p2o.DynamicDimension.1,p2o.DynamicDimension.2]

Snipaste_2024-06-07_08-43-35

[docs]:使用onnxsim修改input_shape可以兼容paddlepaddle现版本
@GreatV
Copy link
Collaborator

GreatV commented Jun 7, 2024

paddle2onnx --model_dir ./inference/ch_PP-OCRv3_det_infer \
--model_filename inference.pdmodel \
--params_filename inference.pdiparams \
--save_file ./inference/det_onnx/model.onnx \
--opset_version 10 \
--enable_onnx_checker True
[Paddle2ONNX] Start to parse PaddlePaddle model...
[Paddle2ONNX] Model file path: ./inference/ch_PP-OCRv3_det_infer/inference.pdmodel
[Paddle2ONNX] Paramters file path: ./inference/ch_PP-OCRv3_det_infer/inference.pdiparams
[Paddle2ONNX] Start to parsing Paddle model...
[Paddle2ONNX] [nearest_interp_v2: nearest_interp_v2_0.tmp_0] Requires the minimal opset version of 11.
[Paddle2ONNX] [nearest_interp_v2: nearest_interp_v2_1.tmp_0] Requires the minimal opset version of 11.
[Paddle2ONNX] [nearest_interp_v2: nearest_interp_v2_2.tmp_0] Requires the minimal opset version of 11.
[Paddle2ONNX] [nearest_interp_v2: nearest_interp_v2_3.tmp_0] Requires the minimal opset version of 11.
[Paddle2ONNX] [nearest_interp_v2: nearest_interp_v2_4.tmp_0] Requires the minimal opset version of 11.
[Paddle2ONNX] [nearest_interp_v2: nearest_interp_v2_5.tmp_0] Requires the minimal opset version of 11.
[Paddle2ONNX] Due to the operator: nearest_interp_v2, requires opset_version >= 11.
[Paddle2ONNX] Opset version will change to 11 from 10
[Paddle2ONNX] Use opset_version = 11 for ONNX export.
[Paddle2ONNX] PaddlePaddle model is exported as ONNX format now.
2024-06-07 08:50:36 [INFO]      ===============Make PaddlePaddle Better!================
2024-06-07 08:50:36 [INFO]      A little survey: https://iwenjuan.baidu.com/?code=r8hu2s

这里我们的--opset_version 10 最好也改为 --opset_version 11

@GreatV
Copy link
Collaborator

GreatV commented Jun 7, 2024

python3.7 改为 python3

Mrxuba added 4 commits June 7, 2024 10:10
修改了不恰当的相关描述
修改了中文版模型导出说明inference_ch.md命名为inference.md
修改不恰当表述
修改所有python3.7为python3
Copy link
Collaborator

@GreatV GreatV left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@GreatV GreatV merged commit 335c5c2 into PaddlePaddle:main Jun 9, 2024
3 checks passed
@luotao1
Copy link
Collaborator

luotao1 commented Oct 15, 2024

@Mrxuba Thanks for your contribution! You will receive a beautiful PaddlePaddle gift. Please provide your mailing address by filling out the following questionnaire before October 18th.

Looking forward to the future, we will walk further together in the world of open source!
Click Here :https://paddle.wjx.cn/vm/h4On9gJ.aspx#

@luotao1
Copy link
Collaborator

luotao1 commented Nov 6, 2024

hi, @Mrxuba

  • 非常感谢你对飞桨的贡献,我们正在运营一个PFCC组织,会通过定期分享技术知识与发布开发者主导任务的形式持续为飞桨做贡献,详情可见 https://github.com/luotao1 主页说明。
  • 如果你对PFCC有兴趣,请发送邮件至 ext_paddle_oss@baidu.com,我们会邀请你加入~

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

Successfully merging this pull request may close these issues.

5 participants