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

paddlehub ultra_light_fast_generic_face_detector_1mb_640转onnx报错 #505

Closed
w-Bro opened this issue Jan 21, 2022 · 4 comments
Closed

paddlehub ultra_light_fast_generic_face_detector_1mb_640转onnx报错 #505

w-Bro opened this issue Jan 21, 2022 · 4 comments
Assignees

Comments

@w-Bro
Copy link

w-Bro commented Jan 21, 2022

请将下面信息填写完整,便于我们快速解决问题,谢谢!
image
模型路径为paddlehub目录下的ultra_light_fast_generic_face_detector_1mb_640 ,是否需要进行其他转换?

命令:paddle2onnx --model_dir ./ultra_light_fast_generic_face_detector_1mb_640 --save_file onnx_file --opset_version 10 --enable_onnx_checker True
版本:paddle2onnx 0.9.0、onnx 1.9.0
问题描述
请在此处详细的描述报错信息

Exception: Error happened when mapping node ['conv2d_0'] to onnx, which op_type is 'conv2d' with inputs: {'Bias': [], 'Filter': ['_base_net_0_0_weight'], 'Input': ['_input'], 'ResidualData': []} and outputs: {'Output': ['_245.tmp_0']}, specific error: The conv data format should be 'NCHW' or 'NCDHW', but received data format is AnyLayout.

更多信息 :

  • 用于部署的推理引擎:
  • 为什么需要转换为ONNX格式:
  • Paddle2ONNX版本:
  • 你的联系方式(Email/Wechat/Phone):

报错截图

其他信息

@jiangjiajun
Copy link
Collaborator

@w-Bro Hi,请安装github上最新代码重新再导出onnx试下

pip uninstall paddle2onnx
git clone https://github.com/PaddlePaddle/Paddle2ONNX.git
cd Paddle2ONNX
python setup.py install

另外我们也准备了一份问卷,方便的话请抽出半分钟时间帮完成问卷 https://iwenjuan.baidu.com/?code=r8hu2s 帮助Paddle2ONNX做得更好

@w-Bro
Copy link
Author

w-Bro commented Jan 21, 2022

还是不行,报了新的错误。

Traceback (most recent call last):
  File "D:\Miniconda3\envs\paddle212-py37\lib\site-packages\paddle2onnx-0.9.0-py3.7.egg\paddle2onnx\op_mapper\op_mapper.py", line 119, in mapping
  File "D:\Miniconda3\envs\paddle212-py37\lib\site-packages\paddle2onnx-0.9.0-py3.7.egg\paddle2onnx\op_mapper\tensor.py", line 35, in opset_4
TypeError: object of type 'NoneType' has no len()

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\Miniconda3\envs\paddle212-py37\Scripts\paddle2onnx-script.py", line 33, in <module>
    sys.exit(load_entry_point('paddle2onnx==0.9.0', 'console_scripts', 'paddle2onnx')())
  File "D:\Miniconda3\envs\paddle212-py37\lib\site-packages\paddle2onnx-0.9.0-py3.7.egg\paddle2onnx\command.py", line 195, in main
  File "D:\Miniconda3\envs\paddle212-py37\lib\site-packages\paddle2onnx-0.9.0-py3.7.egg\paddle2onnx\command.py", line 159, in program2onnx
  File "D:\Miniconda3\envs\paddle212-py37\lib\site-packages\paddle2onnx-0.9.0-py3.7.egg\paddle2onnx\convert.py", line 88, in program2onnx
  File "D:\Miniconda3\envs\paddle212-py37\lib\site-packages\paddle2onnx-0.9.0-py3.7.egg\paddle2onnx\convert.py", line 36, in export_onnx
  File "D:\Miniconda3\envs\paddle212-py37\lib\site-packages\paddle2onnx-0.9.0-py3.7.egg\paddle2onnx\graph\onnx_graph.py", line 262, in build
  File "D:\Miniconda3\envs\paddle212-py37\lib\site-packages\paddle2onnx-0.9.0-py3.7.egg\paddle2onnx\graph\onnx_graph.py", line 209, in build_op_nodes
  File "D:\Miniconda3\envs\paddle212-py37\lib\site-packages\paddle2onnx-0.9.0-py3.7.egg\paddle2onnx\op_mapper\op_mapper.py", line 124, in mapping
Exception: Error happened when mapping node ['concat_0'] to onnx, which op_type is 'concat' with inputs: {'X': ['_290.tmp_2', '_297.tmp_2', '_307.tmp_2']} and outputs: {'Out': ['concat_0.tmp_0']}, specific error: object of type 'NoneType' has no len()

@neonhuang
Copy link
Member

neonhuang commented Jan 24, 2022

你好,这个问题我修复了,你可以使用develop分支
PR:#510
这是因为concat中,node.input('AxisTensor')可能是None;

你可以将paddle2onnx/op_mapper/tensor.py的35行修改如下一下:
node_axis = node.input('AxisTensor')
if node_axis is not None and len(node_axis) > 0:
。。。。

@w-Bro
Copy link
Author

w-Bro commented Jan 24, 2022

可以了,谢谢

@w-Bro w-Bro closed this as completed Jan 24, 2022
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

3 participants