ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

百度开源:PaddleOCR与PaddlePaddle / paddle2onnx 实践一

2020-06-10 15:02:21  阅读:558  来源: 互联网

标签:name PaddleOCR PaddlePaddle fluid ints onnx paddle2onnx model


地址:https://github.com/PaddlePaddle/PaddleOCR 

OCR toolkit based on PaddlePaddle (基于飞桨的OCR工具库,包含总模型仅8.6M的超轻量级中文OCR,同时支持多种文本检测、文本识别的训练算法。)

尝试将paddleOCR项目中的文字检测模型使用/paddle2onnx转换成通用框架模型onnx

目前遇到几个问题:

1.

node_proto = ops.node_maker[str(op.type)](operator=op, block=block)
该行运行到最后一个block时 node_maker中对应值为
'hard_sigmoid': 'HardSigmoid',  # Caffe2 error

就会报str是不可以调用的错误。
目前我的改进办法是遇到hard_sigmoid节点名称强变为'HardSigmoid'后append到onnx_nodes里。

这个问题解决后遇到第二个:

2.

----------- Configuration Arguments -----------
check_task: image_classification
debug: False
fluid_model: D:/work/Paddle/inference/det/
fluid_model_name: model
fluid_params_name: params
image_path:
name_prefix:
onnx_model: D:\work\\Paddle\inference\det
return_variable: False
to_print_model: False
------------------------------------------------
load the model parameter done.
The operator sets to run test case.
{'hard_swish', 'batch_norm', 'elementwise_sub', 'scale', 'elementwise_add', 'relu', 'hard_sigmoid', 'pool2d', 'concat', 'exp', 'elementwise_mul', 'conv2d_transpose', 'sigmoid', 'depthwise_conv2d', 'conv2d', 'reciprocal', 'nearest_interp'}
dict_items([('producer_name', 'PaddlePaddle')])
Traceback (most recent call last):
File "D:/work//paddle2onnx-develop/paddle2onnx-develop/fluid_onnx/fluid_to_onnx.py", line 238, in <module>
main()
File "D:/work/paddle2onnx-develop/paddle2onnx-develop/fluid_onnx/fluid_to_onnx.py", line 234, in main
convert(args)
File "D:/work/paddle2onnx-develop/paddle2onnx-develop/fluid_onnx/fluid_to_onnx.py", line 198, in convert
checker.check_model(onnx_model)
File "D:\setup\Anaconda3\envs\py361\lib\site-packages\onnx\checker.py", line 91, in check_model
C.check_model(model.SerializeToString())
onnx.onnx_cpp2py_export.checker.ValidationError: Nodes in a graph must be topologically sorted, however input 'hard_swish_0.tmp_0' of node:
input: "hard_swish_0.tmp_0" input: "conv2_expand_weights" output: "conv2d_1.tmp_0" op_type: "Conv" attribute { name: "dilations" ints: 1 ints: 1 type: INTS } attribute { name: "group" i: 1 type: INT } attribute { name: "kernel_shape" ints: 1 ints: 1 type: INTS } attribute { name: "pads" ints: 0 ints: 0 ints: 0 ints: 0 type: INTS } attribute { name: "strides" ints: 1 ints: 1 type: INTS }
is not output of any previous nodes.

查了很多资料有的说是onnx的问题,有的说是paddle2onnx还没有支持某些OP.....

问题参考链接:https://github.com/PaddlePaddle/paddle2onnx/issues?q=ValidationError%3A+Nodes+in+a+graph+must+be+topologically+sorted

标签:name,PaddleOCR,PaddlePaddle,fluid,ints,onnx,paddle2onnx,model
来源: https://www.cnblogs.com/zwczp/p/13085198.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有