[Python] Convert onnx model to keras

Discussão em 'Python' iniciado por Stack, Fevereiro 20, 2025.

  1. Stack

    Stack Membro Participativo

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

    ONNX Model Input: input_1

    You can see the ONNX Model here: https://ibb.co/sKnbxWY

    import onnx2keras
    from onnx2keras import onnx_to_keras
    import keras
    import onnx

    onnx_model = onnx.load('onnxModel.onnx')
    k_model = onnx_to_keras(onnx_model, ['input_1'])

    keras.models.save_model(k_model,'kerasModel.h5',overwrite=True,include_optimizer=True)



    File "C:/../onnx2Keras.py", line 7, in <module>
    k_model = onnx_to_keras(onnx_model, ['input_1'])
    File "..\site-packages\onnx2keras\converter.py", line 80, in onnx_to_keras
    weights[onnx_extracted_weights_name] = numpy_helper.to_array(onnx_w)
    TypeError: unhashable type: 'google.protobuf.pyext._message.RepeatedScalarContainer'

    Continue reading...

Compartilhe esta Página