Open prabhat00155 opened 4 years ago
I am trying to convert tiny yolov3 onnx model to keras. I get 'list out of index' error. Code:
import onnx from onnx2keras import onnx_to_keras onnx_model = onnx.load("yolov3-tiny.onnx") # load onnx model k_model = onnx_to_keras(onnx_model, ['input_1', 'image_shape'])
Output:
INFO:onnx2keras:Converter is called. DEBUG:onnx2keras:List input shapes: DEBUG:onnx2keras:None DEBUG:onnx2keras:List inputs: DEBUG:onnx2keras:Input 0 -> input_1. DEBUG:onnx2keras:Input 1 -> image_shape. DEBUG:onnx2keras:List outputs: DEBUG:onnx2keras:Output 0 -> yolonms_layer_1. DEBUG:onnx2keras:Output 1 -> yolonms_layer_1:1. DEBUG:onnx2keras:Output 2 -> yolonms_layer_1:2. DEBUG:onnx2keras:Gathering weights to dictionary. --------------------------------------------------------------------------- TypeError Traceback (most recent call last) ~/Documents/MachineLearning/tmp_env/lib/python3.6/site-packages/onnx2keras/converter.py in onnx_to_keras(onnx_model, input_names, input_shapes, name_policy, verbose, change_ordering) 84 onnx_extracted_weights_name = onnx_w.ListFields()[2][1] ---> 85 weights[onnx_extracted_weights_name] = numpy_helper.to_array(onnx_w) 86 except: TypeError: unhashable type: 'google.protobuf.pyext._message.RepeatedScalarContainer' During handling of the above exception, another exception occurred: IndexError Traceback (most recent call last) <ipython-input-4-588e2e05449f> in <module> ----> 1 k_model = onnx_to_keras(onnx_model, ['input_1', 'image_shape']) ~/Documents/MachineLearning/tmp_env/lib/python3.6/site-packages/onnx2keras/converter.py in onnx_to_keras(onnx_model, input_names, input_shapes, name_policy, verbose, change_ordering) 85 weights[onnx_extracted_weights_name] = numpy_helper.to_array(onnx_w) 86 except: ---> 87 onnx_extracted_weights_name = onnx_w.ListFields()[3][1] 88 weights[onnx_extracted_weights_name] = numpy_helper.to_array(onnx_w) 89 IndexError: list index out of range
Here is the onnx model: https://github.com/onnx/models/tree/master/vision/object_detection_segmentation/tiny_yolov3
Python version: Python 3.6.8 ONNX version: 1.7.0 (installed from source)
Same issue
+1
I am trying to convert tiny yolov3 onnx model to keras. I get 'list out of index' error. Code:
Output:
Here is the onnx model: https://github.com/onnx/models/tree/master/vision/object_detection_segmentation/tiny_yolov3
Python version: Python 3.6.8 ONNX version: 1.7.0 (installed from source)