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.
I install openvino2tensorflow using pip first of all, and I had an issue to convert openvino to tflite for yolo5.
In .xml, the shape is not same as in log output, which is layer 5. The .xml refers (1, 32, 320, 320) and its shape is right, but when I convert for tflite, then the log is not same as .xml.
Can you give me some advice or how to debug this issue?
Relevant Log Output
ERROR: Exception encountered when calling layer "tf.math.add_2" (type TFOpLambda).
Dimensions must be equal, but are 320 and 32 for '{{node tf.math.add_2/Add}} = AddV2[T=DT_FLOAT](Placeholder, tf.math.add_2/Add/y)' with input shapes: [1,320,320,32], [1,32,1,1].
Call arguments received by layer "tf.math.add_2" (type TFOpLambda):
• x=tf.Tensor(shape=(1, 320, 320, 32), dtype=float32)
• y=tf.Tensor(shape=(1, 32, 1, 1), dtype=float32)
• name=None
ERROR: model_path : test/yolov5s_openvino_model/yolov5s.xml
ERROR: weights_path: test/yolov5s_openvino_model/yolov5s.bin
ERROR: layer_id : 6
ERROR: input_layer0 layer_id=3: KerasTensor(type_spec=TensorSpec(shape=(1, 320, 320, 32), dtype=tf.float32, name=None), name='conv2d/Conv2D:0', description="created by layer 'conv2d'")
ERROR: input_layer1 layer_id=5: tf.Tensor(
...
[[ 3.3242188]]]], shape=(1, 32, 1, 1), dtype=float32)
ERROR: The trace log is below.
Traceback (most recent call last):
File "/Users/seunghyunoh/.local/bin/openvino2tensorflow", line 1124, in convert
tf_layers_dict[layer_id] = tf.math.add(tmp_layers[0], tmp_layers[1])
File "/Users/seunghyunoh/miniforge3/envs/deepfilternet/lib/python3.8/site-packages/tensorflow/python/util/traceback_utils.py", line 153, in error_handler
raise e.with_traceback(filtered_tb) from None
File "/Users/seunghyunoh/miniforge3/envs/deepfilternet/lib/python3.8/site-packages/keras/src/layers/core/tf_op_layer.py", line 119, in handle
return TFOpLambda(op)(*args, **kwargs)
File "/Users/seunghyunoh/miniforge3/envs/deepfilternet/lib/python3.8/site-packages/keras/src/utils/traceback_utils.py", line 70, in error_handler
raise e.with_traceback(filtered_tb) from None
ValueError: Exception encountered when calling layer "tf.math.add_2" (type TFOpLambda).
Dimensions must be equal, but are 320 and 32 for '{{node tf.math.add_2/Add}} = AddV2[T=DT_FLOAT](Placeholder, tf.math.add_2/Add/y)' with input shapes: [1,320,320,32], [1,32,1,1].
Call arguments received by layer "tf.math.add_2" (type TFOpLambda):
• x=tf.Tensor(shape=(1, 320, 320, 32), dtype=float32)
• y=tf.Tensor(shape=(1, 32, 1, 1), dtype=float32)
• name=None
ERROR: Please refer to 6-7 in the README first. https://github.com/PINTO0309/openvino2tensorflow
Issue Type
Bug
OS
Mac OS
OS architecture
Other (arm64)
Programming Language
Python
Framework
TensorFlowLite
Download URL for ONNX / OpenVINO IR
yolov5s_openvino_model.zip
Convert Script
openvino2tensorflow --model_path test/yolov5s_openvino_model/yolov5s.xml\ --model_output_path test\ --output_no_quant_float32_tflite
Description
I install openvino2tensorflow using pip first of all, and I had an issue to convert openvino to tflite for yolo5.
In .xml, the shape is not same as in log output, which is layer 5. The .xml refers (1, 32, 320, 320) and its shape is right, but when I convert for tflite, then the log is not same as .xml.
Can you give me some advice or how to debug this issue?
Relevant Log Output
Source code for simple inference testing code
No response