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

C3D model conversion - Depth of input (112) is not a multiple of input depth of filter (3) for '{{node tf.nn.conv3d/Conv3D}} #129

Closed tgcandido closed 1 year ago

tgcandido commented 1 year ago

Issue Type

Bug

OS

Ubuntu

OS architecture

x86_64

Programming Language

Python

Framework

TFLite

Download URL for ONNX / OpenVINO IR

https://pastebin.com/t0BqsAfG

Convert Script

openvino2tensorflow --model_path openvino/c3d-sim.xml --model_output_path ./openvino2tensorflow --output_saved_model --output_no_quant_float32_tflite

Description

Model C3D ( https://t.co/PeRc2UZI6x) was converted from Pytorch to ONNX, then to OpenVino, and finally to TFLite, but there is an error regarding dimensions. I followed this guide https://siliconlabs.github.io/mltk/mltk/tutorials/onnx_to_tflite.html with the C3D model, and the error was found in this specific section https://siliconlabs.github.io/mltk/mltk/tutorials/onnx_to_tflite.html#convert-from-openvino-to-tf-lite-float32.

Relevant Log Output

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

Depth of input (112) is not a multiple of input depth of filter (3) for '{{node tf.nn.conv3d/Conv3D}} = Conv3D[T=DT_FLOAT, data_format="NDHWC", dilations=[1, 1, 1, 1, 1], padding="SAME", strides=[1, 1, 1, 1, 1]](Placeholder, tf.nn.conv3d/Conv3D/filter)' with input shapes: [1,3,16,112,112], [64,3,3,3,3].

Source code for simple inference testing code

No response

PINTO0309 commented 1 year ago
  1. First, read the README section and give it a try. It is almost a transposition of dimensions. https://github.com/PINTO0309/openvino2tensorflow#6-7-replace-weights-or-constant-values-in-const-op-and-add-transpose-or-reshape-or-cast-or-squeeze-or-unsqueeze-or-add-or-multiply-just-beforeafter-the-operation-specified-by-layer_id
  2. Then, please describe in detail what you tried and how the problem occurred. Please describe all. I am not a support desk.

image

Miscellaneous issues are closed immediately.
If you have no intention of returning useful information to the community, you have no right to post an issue here.
Please withdraw.
tgcandido commented 1 year ago

Ok, will try that. Description updated with more detail.