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

Added the ability to extrapolate ZeroPadding1D, ZeroPadding2D, and ZeroPadding3D. #87

Open PINTO0309 opened 2 years ago

PINTO0309 commented 2 years ago

Issue Type

Feature Request

OS

Ubuntu

OS architecture

x86_64, aarch64, armv7, armv6, Other

Programming Language

C++, Python

Framework

OpenVINO, PyTorch, ONNX, TensorFlow, TensorFlowLite, TensorFlow.js, TensorRT, TF-TRT, CoreML, Myriad Inference Engine

Download URL for ONNX / OpenVINO IR

Description

Add the ability to extrapolate ZeroPadding layers with the --weight_replacement_config option.

Relevant Log Output

ERROR: Exception encountered when calling layer "tf.math.add_63" (type TFOpLambda).

Dimensions must be equal, but are 65 and 66 for '{{node tf.math.add_63/Add}} = AddV2[T=DT_FLOAT](Placeholder, Placeholder_1)' with input shapes: [1,65,129,64], [1,66,130,64].

Call arguments received:
  • x=tf.Tensor(shape=(1, 65, 129, 64), dtype=float32)
  • y=tf.Tensor(shape=(1, 66, 130, 64), dtype=float32)
  • name=None
ERROR: model_path  : saved_model_resnet18_2d_257x513/openvino/FP32/resnet18_2d_257x513.xml
ERROR: weights_path: saved_model_resnet18_2d_257x513/openvino/FP32/resnet18_2d_257x513.bin
ERROR: layer_id    : 309
ERROR: input_layer0 layer_id=288: KerasTensor(type_spec=TensorSpec(shape=(1, 65, 129, 64), dtype=tf.float32, name=None), name='tf.nn.elu_38/Elu:0', description="created by layer 'tf.nn.elu_38'")
ERROR: input_layer1 layer_id=308: KerasTensor(type_spec=TensorSpec(shape=(1, 66, 130, 64), dtype=tf.float32, name=None), name='tf.math.add_60/Add:0', description="created by layer 'tf.math.add_60'")
ERROR: The trace log is below.
Traceback (most recent call last):
  File "/usr/local/bin/openvino2tensorflow", line 1019, in convert
    tf_layers_dict[layer_id] = tf.math.add(tmp_layers[0], tmp_layers[1])
  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.math.add_63" (type TFOpLambda).

Dimensions must be equal, but are 65 and 66 for '{{node tf.math.add_63/Add}} = AddV2[T=DT_FLOAT](Placeholder, Placeholder_1)' with input shapes: [1,65,129,64], [1,66,130,64].

Call arguments received:
  • x=tf.Tensor(shape=(1, 65, 129, 64), dtype=float32)
  • y=tf.Tensor(shape=(1, 66, 130, 64), dtype=float32)
  • name=None

Source code for simple inference testing code

No response