gmalivenko/onnx2keras

ValueError: Exception encountered when calling layer "LAYER_0" (type Conv2D).

md-rifatkhan opened this issue · 1 comments

I'm getting error while converting real-esrgan anime 6b onnx

Traceback (most recent call last):
  File "C:\Users\user\Downloads\onnx2keras-master\onnx2keras-master\call.py", line 8, in <module>
    k_model = onnx_to_keras(onnx_model, ['input'],  name_policy='renumerate')
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\Downloads\onnx2keras-master\onnx2keras-master\onnx2keras\converter.py", line 176, in onnx_to_keras
    AVAILABLE_CONVERTERS[node_type](
  File "C:\Users\user\Downloads\onnx2keras-master\onnx2keras-master\onnx2keras\convolution_layers.py", line 177, in convert_conv     
    layers[node_name] = conv(input_0)
                        ^^^^^^^^^^^^^
ValueError: Exception encountered when calling layer "LAYER_0" (type Conv2D).

Negative dimension size caused by subtracting 3 from 2 for '{{node LAYER_0/Conv2D}} = Conv2D[T=DT_FLOAT, data_format="NCHW", dilations=[1, 1, 1, 1], explicit_paddings=[], padding="VALID", strides=[1, 1, 1, 1], use_cudnn_on_gpu=true](Placeholder, LAYER_0/Conv2D/ReadVariableOp)' with input shapes: [?,3,2,2], [3,3,3,64].

Call arguments received by layer "LAYER_0" (type Conv2D):
  • inputs=tf.Tensor(shape=(None, 3, 2, 2), dtype=float32)

with

import onnx
from onnx2keras import onnx_to_keras

# Load ONNX model
onnx_model = onnx.load('RealESRGAN_x4plus_anime_6B.onnx')

# Call the converter (input - is the main model input name, can be different for your model)
k_model = onnx_to_keras(onnx_model, ['input'],  name_policy='renumerate')

I got the same error. Did you find any solution yet?