PINTO0309 / openvino2tensorflow

This script converts the ONNX/OpenVINO IR model to Tensorflow's saved_model, tflite, h5, tfjs, tftrt(TensorRT), CoreML, EdgeTPU, ONNX and pb. PyTorch (NCHW) -> ONNX (NCHW) -> OpenVINO (NCHW) -> openvino2tensorflow -> Tensorflow/Keras (NHWC/NCHW) -> TFLite (NHWC/NCHW). And the conversion from .pb to saved_model and from saved_model to .pb and from .pb to .tflite and saved_model to .tflite and saved_model to onnx. Support for building environments with Docker. It is possible to directly access the host PC GUI and the camera to verify the operation. NVIDIA GPU (dGPU) support. Intel iHD GPU (iGPU) support.
MIT License
334 stars 40 forks source link

Error processing conv2d "Depth of output (256) is not a multiple of the number of groups (2176)" #95

Closed turbobuilt closed 2 years ago

turbobuilt commented 2 years ago

Issue Type

Bug

OS

Ubuntu

OS architecture

x86_64

Programming Language

Python

Framework

OpenVINO, TensorFlow

Download URL for ONNX / OpenVINO IR

https://storage.openvinotoolkit.org/repositories/open_model_zoo/2022.1/models_bin/3/noise-suppression-poconetlike-0001/FP32/noise-suppression-poconetlike-0001.xml

https://storage.openvinotoolkit.org/repositories/open_model_zoo/2022.1/models_bin/3/noise-suppression-poconetlike-0001/FP32/noise-suppression-poconetlike-0001.bin

Convert Script

openvino2tensorflow --model_path noise-suppression-poconetlike-0001.xml --output_saved_model

Description

When attempting to convert the above model, I get

ERROR: Exception encountered when calling layer "tf.nn.conv2d" (type TFOpLambda).

Depth of output (256) is not a multiple of the number of groups (2176) for '{{node tf.nn.conv2d/Conv2D}} = Conv2D[T=DT_FLOAT, data_format="NHWC", dilations=[1, 1, 1, 1], explicit_paddings=[], padding="VALID", strides=[1, 128, 128, 1], use_cudnn_on_gpu=true](Placeholder, tf.nn.conv2d/Conv2D/filter)' with input shapes: [1,1,1,2176], [258,1,1,256].

Relevant Log Output

Call arguments received:

  • input=tf.Tensor(shape=(1, 1, 1, 2176), dtype=float32)
  • strides=['128', '128']

  • padding='VALID'

  • data_format=NHWC

  • dilations=['1', '1']

  • name=None

I put some debug code to print out the filters shape: (258, 1, 1, 256)

...
Traceback (most recent call last):

  File "/usr/local/bin/openvino2tensorflow", line 838, in convert

    tf_layers_dict[layer_id] = tf.nn.conv2d(

  File "/usr/local/lib/python3.8/dist-packages/tensorflow/python/util/traceback_utils.py", line 153, in error_handler

    raise e.with_traceback(filtered_tb) from None

  File "/usr/local/lib/python3.8/dist-packages/keras/layers/core/tf_op_layer.py", line 107, in handle

    return TFOpLambda(op)(*args, **kwargs)

  File "/usr/local/lib/python3.8/dist-packages/keras/utils/traceback_utils.py", line 67, in error_handler

    raise e.with_traceback(filtered_tb) from None

ValueError: Exception encountered when calling layer "tf.nn.conv2d" (type TFOpLambda).

ERROR: model_path  : noise-suppression-poconetlike-0001.xml

ERROR: weights_path: noise-suppression-poconetlike-0001.bin

ERROR: layer_id    : 57

ERROR: input_layer0 layer_id=55: KerasTensor(type_spec=TensorSpec(shape=(1, 1, 1, 2176), dtype=tf.float32, name=None), name='tf.expand_dims_1/ExpandDims:0', description="created by layer 'tf.expand_dims_1'")

ERROR: input_layer1 layer_id=56: Const(ndarray).shape  (258, 1, 1, 256)

Source code for simple inference testing code

No response

PINTO0309 commented 2 years ago

WIP commit: 2d6cdea8c210a98984c4bb8b64c76dee3b4d3119 commit: 73f6d5ce95a0277ac25deb15b6209e26eaa2af3b Release: v1.29.2 https://github.com/PINTO0309/openvino2tensorflow/releases/tag/v1.29.2