Paddle2ONNX icon indicating copy to clipboard operation
Paddle2ONNX copied to clipboard

mobileseg_shufflenetv2 导出报错

Open chen-del opened this issue 2 years ago • 4 comments

Please fill in the information below so that we can solve the problem quickly, Thanks !

Describe the bug A clear and concise description of what the bug is. W0228 17:40:05.151883 24972 gpu_resources.cc:61] Please NOTE: device: 0, GPU Compute Capability: 8.6, Driver API Version: 11.4, Runtime API Version: 11.1 W0228 17:40:05.173039 24972 gpu_resources.cc:91] device: 0, cuDNN Version: 8.2. 2023-02-28 17:40:07 [INFO] Loading pretrained model from https://paddleseg.bj.bcebos.com/dygraph/backbone/shufflenetv2_x1_0.zip 2023-02-28 17:40:07 [INFO] There are 275/275 variables loaded into ShuffleNet. 2023-02-28 17:40:07 [INFO] Loaded trained params of model successfully. /home/dell/anaconda3/envs/bagtorch/lib/python3.8/site-packages/paddle/fluid/layers/math_op_patch.py:336: UserWarning: /tmp/tmpp9nemwh5.py:26 The behavior of expression A + B has been unified with elementwise_add(X, Y, axis=-1) from Paddle 2.0. If your code works well in the older versions but crashes in this version, try to use elementwise_add(X, Y, axis=0) instead of A + B. This transitional warning will be dropped in the future. warnings.warn( /home/dell/anaconda3/envs/bagtorch/lib/python3.8/site-packages/paddle/fluid/layers/math_op_patch.py:336: UserWarning: /tmp/tmp6zud28gx.py:7 The behavior of expression A + B has been unified with elementwise_add(X, Y, axis=-1) from Paddle 2.0. If your code works well in the older versions but crashes in this version, try to use elementwise_add(X, Y, axis=0) instead of A + B. This transitional warning will be dropped in the future. warnings.warn( /home/dell/anaconda3/envs/bagtorch/lib/python3.8/site-packages/paddle/fluid/layers/math_op_patch.py:336: UserWarning: /tmp/tmpgrc0jysf.py:7 The behavior of expression A + B has been unified with elementwise_add(X, Y, axis=-1) from Paddle 2.0. If your code works well in the older versions but crashes in this version, try to use elementwise_add(X, Y, axis=0) instead of A + B. This transitional warning will be dropped in the future. warnings.warn( /home/dell/anaconda3/envs/bagtorch/lib/python3.8/site-packages/paddle/fluid/layers/math_op_patch.py:336: UserWarning: /tmp/tmp5mcont17.py:7 The behavior of expression A + B has been unified with elementwise_add(X, Y, axis=-1) from Paddle 2.0. If your code works well in the older versions but crashes in this version, try to use elementwise_add(X, Y, axis=0) instead of A + B. This transitional warning will be dropped in the future. warnings.warn( 2023-02-28 17:40:11 [INFO] Model is saved in ./output/mobilennetv3_psphead__256x256_80k/. /home/dell/anaconda3/envs/bagtorch/lib/python3.8/site-packages/paddle2onnx/constant/dtypes.py:47: DeprecationWarning: np.bool is a deprecated alias for the builtin bool. To silence this warning, use bool by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use np.bool_ here. Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations np.bool: core.VarDesc.VarType.BOOL, /home/dell/anaconda3/envs/bagtorch/lib/python3.8/site-packages/paddle2onnx/constant/dtypes.py:48: DeprecationWarning: np.float is a deprecated alias for the builtin float. To silence this warning, use float by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use np.float64 here. Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations core.VarDesc.VarType.FP32: np.float, /home/dell/anaconda3/envs/bagtorch/lib/python3.8/site-packages/paddle2onnx/constant/dtypes.py:53: DeprecationWarning: np.bool is a deprecated alias for the builtin bool. To silence this warning, use bool by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use np.bool_ here. Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations core.VarDesc.VarType.BOOL: np.bool Traceback (most recent call last): File "/home/dell/anaconda3/envs/bagtorch/lib/python3.8/site-packages/paddle2onnx/op_mapper/op_mapper.py", line 119, in mapping mapper_func(graph, node, **kw) File "/home/dell/anaconda3/envs/bagtorch/lib/python3.8/site-packages/paddle2onnx/op_mapper/nn.py", line 167, in opset_1 raise Exception( Exception: Converting this model to ONNX need with static input shape, please fix input shape of this model, see doc Q2 in https://github.com/PaddlePaddle/paddle2onnx/blob/develop/docs/en/FAQ.md.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/dell/anaconda3/envs/bagtorch/bin/paddle2onnx", line 8, in sys.exit(main()) File "/home/dell/anaconda3/envs/bagtorch/lib/python3.8/site-packages/paddle2onnx/command.py", line 218, in main program2onnx( File "/home/dell/anaconda3/envs/bagtorch/lib/python3.8/site-packages/paddle2onnx/command.py", line 173, in program2onnx p2o.program2onnx( File "/home/dell/anaconda3/envs/bagtorch/lib/python3.8/site-packages/paddle2onnx/convert.py", line 94, in program2onnx return export_onnx( File "/home/dell/anaconda3/envs/bagtorch/lib/python3.8/site-packages/paddle2onnx/convert.py", line 35, in export_onnx onnx_graph = ONNXGraph.build(paddle_graph, opset_version, File "/home/dell/anaconda3/envs/bagtorch/lib/python3.8/site-packages/paddle2onnx/graph/onnx_graph.py", line 331, in build onnx_graph.build_op_nodes(paddle_graph.node_map) File "/home/dell/anaconda3/envs/bagtorch/lib/python3.8/site-packages/paddle2onnx/graph/onnx_graph.py", line 209, in build_op_nodes OpMapper.mapping(self, node, self.operator_export_type) File "/home/dell/anaconda3/envs/bagtorch/lib/python3.8/site-packages/paddle2onnx/op_mapper/op_mapper.py", line 121, in mapping raise Exception( Exception: Error happened when mapping node ['pool2d_2'] to onnx, which op_type is 'pool2d' with inputs: {'X': ['reshape2_31.tmp_0']} and outputs: {'Out': ['pool2d_2.tmp_0']}, specific error: Converting this model to ONNX need with static input shape, please fix input shape of this model, see doc Q2 in https://github.com/PaddlePaddle/paddle2onnx/blob/develop/docs/en/FAQ.md.

chen-del avatar Feb 28 '23 09:02 chen-del

请参考:https://github.com/PaddlePaddle/paddle2onnx/blob/develop/docs/en/FAQ.md 先固定住模型的shape之后再进行导出

yeliang2258 avatar Mar 01 '23 02:03 yeliang2258

我每次导出都使用了input_shape去固定输入,但是实际上这次好像并没有生效,转化直接失败了

chen-del avatar Mar 01 '23 02:03 chen-del

@yeliang2258 ,我将形状进行固定了输入的shape,但是似乎它的形状推断到了这个位置下面没有办法推断,不知道是哪里出现了问题,我想知道这个是可以正常转化的标准配置吗? image 类似于这样它在这个位置,没有办法正常推断了。

chen-del avatar Mar 21 '23 09:03 chen-del

我也碰到类似的问题,这个问题解决了吗

13950182204 avatar Jan 27 '24 09:01 13950182204