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 have tried converting the "person-reidentification-retail-0277" xml/bin file models. But could not convert after a long trial. Would you mind helping to convert this model into tensorflow?
In general, the layer output shapes seem weird. For example the output of layer "Gather_9248" seems not matching with the graph (from Netron): [1, 3, 128, 3] vs [1,3,256,128].
Relevant Log Output
ERROR: input_layer1 layer_id=91: KerasTensor(type_spec=TensorSpec(shape=(4, 64, 1, 64), dtype=tf.float32, name=None), name='tf.nn.relu_6/Relu:0', description="created by layer 'tf.nn.relu_6'")
ERROR: The trace log is below.
Traceback (most recent call last):
File "./openvino2tensorflow/openvino2tensorflow/openvino2tensorflow.py", line 878, 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).
Negative dimension size caused by subtracting 64 from 1 for '{{node tf.nn.conv2d/Conv2D}} = Conv2D[T=DT_FLOAT, data_format="NHWC", dilations=[1, 1, 1, 1], explicit_paddings=[], padding="VALID", strides=[1, 1, 1, 1], use_cudnn_on_gpu=true](tf.nn.conv2d/Conv2D/input, Placeholder)' with input shapes: [64,4,1,1], [4,64,1,64].
Call arguments received by layer "tf.nn.conv2d" (type TFOpLambda):
• input=tf.Tensor(shape=(64, 4, 1, 1), dtype=float32)
• filters=tf.Tensor(shape=(4, 64, 1, 64), dtype=float32)
• strides=['1', '1']
• padding='VALID'
• data_format=NHWC
• dilations=['1', '1']
• name=None
ERROR: Please refer to 6-7 in the README first. https://github.com/PINTO0309/openvino2tensorflow
Issue Type
Feature Request
OS
Ubuntu
OS architecture
x86_64
Programming Language
Python
Framework
TensorFlow
Download URL for ONNX / OpenVINO IR
https://docs.openvino.ai/latest/omz_models_model_person_reidentification_retail_0277.html
Convert Script
https://github.com/PINTO0309/openvino2tensorflow/blob/main/openvino2tensorflow/openvino2tensorflow.py
Description
I have tried converting the "person-reidentification-retail-0277" xml/bin file models. But could not convert after a long trial. Would you mind helping to convert this model into tensorflow?
In general, the layer output shapes seem weird. For example the output of layer "Gather_9248" seems not matching with the graph (from Netron): [1, 3, 128, 3] vs [1,3,256,128].
Relevant Log Output
Source code for simple inference testing code
No response