INFO:root:paddle.version = 2.4.2
INFO:root:Now translating model from onnx to paddle.
model ir_version: 6, op version: 10
Shape inferencing ...
Shape inferenced.
Now, onnx2paddle support convert onnx model opset_verison [7, 8, 9, 10, 11, 12, 13, 14, 15], opset_verison of your onnx model is 10.
Total nodes: 152
Nodes converting ...
Converting node 287 ...
Nodes converted.
INFO:root:Model optimizing ...
INFO:root:Model optimized.
Exporting inference model from python code ('/media/experiment/PaddlePaddle/PaddleSlim/example/post_training_quantization/onnx_seg/TwinLiteNet-onnxruntime/pd_model/x2paddle_code.py')...
W1117 13:07:37.444545 392280 gpu_resources.cc:61] Please NOTE: device: 0, GPU Compute Capability: 7.5, Driver API Version: 11.7, Runtime API Version: 10.2
W1117 13:07:37.445227 392280 gpu_resources.cc:91] device: 0, cuDNN Version: 8.7.
/opt/anaconda3/envs/paddle2.4_py3.7/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py:1652: UserWarning: Skip loading for conv2.weight. conv2.weight receives a shape [12, 19, 3, 3], but the expected shape is [12, 64, 3, 3].
warnings.warn(("Skip loading for {}. ".format(key) + str(err)))
/opt/anaconda3/envs/paddle2.4_py3.7/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py:1652: UserWarning: Skip loading for conv8.weight. conv8.weight receives a shape [12, 19, 3, 3], but the expected shape is [12, 64, 1, 1].
warnings.warn(("Skip loading for {}. ".format(key) + str(err)))
/opt/anaconda3/envs/paddle2.4_py3.7/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py:1652: UserWarning: Skip loading for conv21.weight. conv21.weight receives a shape [25, 131, 3, 3], but the expected shape is [25, 128, 3, 3].
warnings.warn(("Skip loading for {}. ".format(key) + str(err)))
/opt/anaconda3/envs/paddle2.4_py3.7/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py:1652: UserWarning: Skip loading for conv27.weight. conv27.weight receives a shape [25, 131, 3, 3], but the expected shape is [25, 128, 1, 1].
warnings.warn(("Skip loading for {}. ".format(key) + str(err)))
In transformed code:
File "pd_model/x2paddle_code.py", line 116, in forward
x2paddle_440 = self.conv1(x2paddle_194)
x2paddle_198 = self.prelu1(x2paddle_440)
x2paddle_199 = self.conv2(x2paddle_198)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <--- HERE
x2paddle_200 = self.conv3(x2paddle_199)
x2paddle_201 = self.conv4(x2paddle_199)
File "/opt/anaconda3/envs/paddle2.4_py3.7/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py", line 1014, in __call__
return self._dygraph_call_func(*inputs, **kwargs)
File "/opt/anaconda3/envs/paddle2.4_py3.7/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py", line 993, in _dygraph_call_func
outputs = self.forward(*inputs, **kwargs)
File "/opt/anaconda3/envs/paddle2.4_py3.7/lib/python3.7/site-packages/paddle/nn/layer/conv.py", line 724, in forward
use_cudnn=self._use_cudnn,
File "/opt/anaconda3/envs/paddle2.4_py3.7/lib/python3.7/site-packages/paddle/nn/functional/conv.py", line 277, in _conv_nd
type=op_type, inputs=inputs, outputs=outputs, attrs=attrs
File "/opt/anaconda3/envs/paddle2.4_py3.7/lib/python3.7/site-packages/paddle/fluid/layer_helper.py", line 45, in append_op
return self.main_program.current_block().append_op(*args, **kwargs)
File "/opt/anaconda3/envs/paddle2.4_py3.7/lib/python3.7/site-packages/paddle/fluid/framework.py", line 4046, in append_op
attrs=kwargs.get("attrs", None),
File "/opt/anaconda3/envs/paddle2.4_py3.7/lib/python3.7/site-packages/paddle/fluid/framework.py", line 3037, in __init__
self.desc.infer_shape(self.block.desc)
ValueError: (InvalidArgument) The number of input's channels should be equal to filter's channels * groups for Op(Conv). But received: the input's channels is 19, the input's shape is [1, 19, 180, 320]; the filter's channels is 64, the filter's shape is [12, 64, 3, 3]; the groups is 1, the data_format is NCHW. The error may come from wrong data_format setting.
[Hint: Expected input_channels == filter_dims[1] groups, but received input_channels:19 != filter_dims[1] groups:64.] (at /paddle/paddle/fluid/operators/conv_op.cc:131)
[operator < conv2d > error]
问题描述
TwinLiteNet:pytorch转onnx转paddle报错
具体信息
INFO:root:paddle.version = 2.4.2 INFO:root:Now translating model from onnx to paddle. model ir_version: 6, op version: 10 Shape inferencing ... Shape inferenced. Now, onnx2paddle support convert onnx model opset_verison [7, 8, 9, 10, 11, 12, 13, 14, 15], opset_verison of your onnx model is 10. Total nodes: 152 Nodes converting ... Converting node 287 ...
Nodes converted. INFO:root:Model optimizing ... INFO:root:Model optimized. Exporting inference model from python code ('/media/experiment/PaddlePaddle/PaddleSlim/example/post_training_quantization/onnx_seg/TwinLiteNet-onnxruntime/pd_model/x2paddle_code.py')...
W1117 13:07:37.444545 392280 gpu_resources.cc:61] Please NOTE: device: 0, GPU Compute Capability: 7.5, Driver API Version: 11.7, Runtime API Version: 10.2 W1117 13:07:37.445227 392280 gpu_resources.cc:91] device: 0, cuDNN Version: 8.7. /opt/anaconda3/envs/paddle2.4_py3.7/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py:1652: UserWarning: Skip loading for conv2.weight. conv2.weight receives a shape [12, 19, 3, 3], but the expected shape is [12, 64, 3, 3]. warnings.warn(("Skip loading for {}. ".format(key) + str(err))) /opt/anaconda3/envs/paddle2.4_py3.7/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py:1652: UserWarning: Skip loading for conv8.weight. conv8.weight receives a shape [12, 19, 3, 3], but the expected shape is [12, 64, 1, 1]. warnings.warn(("Skip loading for {}. ".format(key) + str(err))) /opt/anaconda3/envs/paddle2.4_py3.7/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py:1652: UserWarning: Skip loading for conv21.weight. conv21.weight receives a shape [25, 131, 3, 3], but the expected shape is [25, 128, 3, 3]. warnings.warn(("Skip loading for {}. ".format(key) + str(err))) /opt/anaconda3/envs/paddle2.4_py3.7/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py:1652: UserWarning: Skip loading for conv27.weight. conv27.weight receives a shape [25, 131, 3, 3], but the expected shape is [25, 128, 1, 1]. warnings.warn(("Skip loading for {}. ".format(key) + str(err))) In transformed code:
[Hint: Expected input_channels == filter_dims[1] groups, but received input_channels:19 != filter_dims[1] groups:64.] (at /paddle/paddle/fluid/operators/conv_op.cc:131) [operator < conv2d > error]
来源框架版本(PyTorch/TF/ONNX/Caffe) => :PyTorch->onnx