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

KeyError when running openvino2tensorflow #99

Closed zenetio closed 2 years ago

zenetio commented 2 years ago

Issue Type

Bug

OS

Ubuntu

OS architecture

x86_64

Programming Language

Python

Framework

OpenVINO

Download URL for ONNX / OpenVINO IR

https://drive.google.com/drive/folders/17qXTLYHrWSVZlJlYMVCL14-jMztibmF-?usp=sharing

Convert Script

python miniconda3/envs/yo1/Scripts/openvino2tensorflow --model_path ./openvino/my2yolov5s.xml --model_output_path tflite --output_pb --output_saved_model --output_no_quant_float32_tflite

Description

https://drive.google.com/drive/folders/17qXTLYHrWSVZlJlYMVCL14-jMztibmF-?usp=sharing

Relevant Log Output

ERROR: '172:1'
ERROR: model_path  : ./openvino/my2yolov5s.xml
ERROR: weights_path: ./openvino/my2yolov5s.bin
ERROR: layer_id    : 173
ERROR: The trace log is below.
Traceback (most recent call last):
  File "miniconda3/envs/yo1/Scripts/openvino2tensorflow", line 1715, in convert
    temp = tf_layers_dict[get_tf_edges_from(tf_edges, layer_id, 0)]
  File "miniconda3/envs/yo1/Scripts/openvino2tensorflow", line 265, in get_tf_edges_from
    before_layer_type = get_bere_layer_type(tf_edges[key][edge_index])
  File "miniconda3/envs/yo1/Scripts/openvino2tensorflow", line 234, in get_bere_layer_type
    t = type(tf_layers_dict[before_layer])
KeyError: '172:1'
ERROR: Please refer to 6-7 in the README first. https://github.com/PINTO0309/openvino2tensorflow

Source code for simple inference testing code

No response

hayoyo12 commented 2 years ago

Same problem :(( I tried to convert mnist-8.onnx model to tensorflow. It was able to convert last week, but i got the same KeyError:'6:1" issues in layer 8 and cannot convert the model.

PINTO0309 commented 2 years ago

https://github.com/PINTO0309/openvino2tensorflow/issues?q=yolov5

hayoyo12 commented 2 years ago

@PINTO0309 why is it closed?

PINTO0309 commented 2 years ago

Your questions have already been resolved. Please do an issue search first.

zenetio commented 2 years ago

I did a search in all issues and could not find one related to this keyError. Could you please point out where is the resolved solution?

PINTO0309 commented 2 years ago

OpenVINO 2022.1 in opset8 is not supported. If you don't want to use containers, give up. The cost is very high and I do not plan to solve this problem for a while.

PINTO0309 commented 2 years ago

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

PINTO0309 commented 2 years ago

Note added. image

zenetio commented 2 years ago

@PINTO0309 , tks for the tip, #100. After downloading the weights v5 and creating an env using the requirements, I could succeed in the complete conversion.

PINTO0309 commented 2 years ago

Fix: https://github.com/PINTO0309/openvino2tensorflow/commit/f719975560abedfe9beabfd371ce60e24cda043a openvino2tensorflow v1.29.6