gmalivenko / onnx2keras

Convert ONNX model graph to Keras model format.
MIT License
193 stars 115 forks source link

TypeError: unhashable type: 'google._upb._message.RepeatedScalarContainer' #166

Open kurpav00 opened 1 year ago

kurpav00 commented 1 year ago

I am trying to convert an ONNX model to Keras, but when I call the conversion function I receive the following error message "TypeError: unhashable type: 'google._upb._message.RepeatedScalarContainer'"

import onnx
from onnx2keras import onnx_to_keras
onnx_model = onnx.load('model.onnx')
k_model = onnx_to_keras(onnx_model, ['image'])

Results in:

INFO:onnx2keras:Converter is called.
DEBUG:onnx2keras:List input shapes:
DEBUG:onnx2keras:None
DEBUG:onnx2keras:List inputs:
DEBUG:onnx2keras:Input 0 -> image.
DEBUG:onnx2keras:List outputs:
DEBUG:onnx2keras:Output 0 -> TFLITE2ONNX_Quant_scores_dequantized.
DEBUG:onnx2keras:Gathering weights to dictionary.
Traceback (most recent call last):
  File "/home/kurpav00/anaconda3/envs/tf/lib/python3.9/site-packages/onnx2keras-0.0.24-py3.9.egg/onnx2keras/converter.py", line 86, in onnx_to_keras
    weights[onnx_extracted_weights_name] = numpy_helper.to_array(onnx_w)
TypeError: unhashable type: 'google._upb._message.RepeatedScalarContainer'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/kurpav00/anaconda3/envs/tf/lib/python3.9/site-packages/onnx2keras-0.0.24-py3.9.egg/onnx2keras/converter.py", line 88, in onnx_to_keras
    onnx_extracted_weights_name = onnx_w.ListFields()[3][1]
IndexError: list index out of range

It seems to be the same error as in #23 although it is claimed to be fixed. Using "name_policy='renumerate'" also does not help.

Here is the ONNX model used: model.zip

alfredoescalante95 commented 1 year ago

I am getting the same error, any update on this?

kurpav00 commented 1 year ago

@alfredoescalante95 Unfortunately no; the repository seems abandoned.

pythonmonty commented 6 months ago

I'm also getting the exact same error