gmalivenko / onnx2keras

Convert ONNX model graph to Keras model format.
MIT License
195 stars 116 forks source link

ValueError: `padding` should have 3 elements. Received: [0]. #153

Open Eien9 opened 2 years ago

Eien9 commented 2 years ago

i was trying to export .onnx file to .h5 file i don't konw how to solve this error DEBUG:onnx2keras:Output TF Layer -> KerasTensor(type_spec=TensorSpec(shape=(None, 128, 42), dtype=tf.float32, name=None), name='input.1/transpose_1:0', description="created by layer 'input.1'") DEBUG:onnx2keras:###### DEBUG:onnx2keras:... DEBUG:onnx2keras:Converting ONNX operation DEBUG:onnx2keras:type: Relu DEBUG:onnx2keras:node_name: onnx::MaxPool_16 DEBUG:onnx2keras:node_params: {'change_ordering': False, 'name_policy': None} DEBUG:onnx2keras:... DEBUG:onnx2keras:Check if all inputs are available: DEBUG:onnx2keras:Check input 0 (name input.1). DEBUG:onnx2keras:... found all, continue DEBUG:onnx2keras:###### DEBUG:onnx2keras:... DEBUG:onnx2keras:Converting ONNX operation DEBUG:onnx2keras:type: MaxPool DEBUG:onnx2keras:node_name: input.4 DEBUG:onnx2keras:node_params: {'kernel_shape': [2], 'pads': [0, 0], 'strides': [2], 'change_ordering': False, 'name_policy': None} DEBUG:onnx2keras:... DEBUG:onnx2keras:Check if all inputs are available: DEBUG:onnx2keras:Check input 0 (name onnx::MaxPool_16). DEBUG:onnx2keras:... found all, continue WARNING:onnx2keras:maxpool:Unable to use same padding. Add ZeroPadding2D layer to fix shapes. Traceback (most recent call last): File "f:/vscode_workspace/model_output/to_onnx.py", line 101, in onnx_to_h5(input_path, output_path) #将onnx模型转换为h5模型 File "f:/vscode_workspace/model_output/to_onnx.py", line 54, in onnx_to_h5 k_model = onnx_to_keras(onnx_model, ['input']) File "D:\miniconda\envs\d2l\lib\site-packages\onnx2keras\converter.py", line 178, in onnx_to_keras AVAILABLE_CONVERTERS[node_type]( File "D:\miniconda\envs\d2l\lib\site-packages\onnx2keras\pooling_layers.py", line 50, in convert_maxpool padding_layer = keras.layers.ZeroPadding3D( File "D:\miniconda\envs\d2l\lib\site-packages\keras\layers\reshaping\zero_padding3d.py", line 94, in init raise ValueError( ValueError: padding should have 3 elements. Received: [0].

BGG19 commented 1 year ago

hey, I've got the same problem now. Did you find any way to fix it ?