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

IndexError: list index out of range #137

Closed SirNader closed 1 year ago

SirNader commented 1 year ago

Issue Type

Bug

OS

Ubuntu

OS architecture

x86_64

Programming Language

Python

Framework

OpenVINO, TensorFlow, TensorFlowLite

Download URL for ONNX / OpenVINO IR

https://drive.google.com/file/d/1fr7p1p7gqnBFw9ykeRmqgfZpaitSdBMx/view?usp=share_link

Convert Script

openvino2tensorflow --model_path openvino/ABINet.simplified.xml --output_saved_model --output_pb --output_weight_quant_tflite --output_float16_quant_tflite --output_no_quant_float32_tflite

Description

I was trying to convert an OpenVINO model to Tensorflow and TFLite and I ended up with this error, I'd be grateful if you manage to help me out with this. Thank you!

Relevant Log Output

2023-02-04 18:28:43.571885: I tensorflow/core/util/util.cc:169] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
TensorFlow/Keras model building process starts ======================================
Layer structure =====================================================================
Traceback (most recent call last):
  File "/home/nader/miniconda3/envs/tf/bin/openvino2tensorflow", line 7887, in <module>
    main()
  File "/home/nader/miniconda3/envs/tf/bin/openvino2tensorflow", line 7871, in main
    convert(model, model_output_path, output_saved_model, output_h5, output_weight_and_json, output_pb, dont_convert_from_keras_model,
  File "/home/nader/miniconda3/envs/tf/bin/openvino2tensorflow", line 592, in convert
    temp_sorted_tf_edge.append(tf_edges[to_layer][ports.index(str(idx))])
IndexError: list index out of range

Source code for simple inference testing code

No response

PINTO0309 commented 1 year ago

Please share ONNX files. Also, please share the URL of the repository from which you got the quote. Engineers around the world would be pleased if you would also share the code you used to convert from PyTorch to ONNX.

I recommend the use of the latest tool here. No conversion errors occur and no accuracy errors are introduced. It also supports complex models such as Transformer. openvino2tensorflow is not actively maintained at this time. https://github.com/PINTO0309/onnx2tf

https://github.com/PINTO0309/openvino2tensorflow/issues/136

SirNader commented 1 year ago

Please share ONNX files. Also, please share the URL of the repository from which you got the quote. Engineers around the world would be pleased if you would also share the code you used to convert from PyTorch to ONNX.

I recommend the use of the latest tool here. No conversion errors occur and no accuracy errors are introduced. It also supports complex models such as Transformer. openvino2tensorflow is not actively maintained at this time. https://github.com/PINTO0309/onnx2tf

136

Thank you for your reply, I will use onnx2tf and see if I can get this to work.