onnx/keras-onnx

AttributeError: 'MaskRCNN' object has no attribute 'layers'

RyuAmakaze opened this issue · 3 comments

This error is similar to #592
I'm trying to convert an .h5 file trained by maskRCNN to onnx.

When I try to convert a MaskRCNN model with keras2onnx.convert_keras, I encounter the error
AttributeError: 'MaskRCNN' object has no attribute 'outputs'

So I upgraded the version of keras2onnx to 1.8.0. I upgraded keras2onnx to version 1.8.0, and got the following error message.
AttributeError: 'MaskRCNN' object has no attribute 'layers'

Also, I would like to know if there is another good way to convert .h5 files trained with MaskRCNN to onnx.
Help me! ><

Could you try tensorflow 2.2.0?

Already done it and same error.
But I can do your tutorial "TensorFlow_Keras_MNIST.ipynb" :)

I think the biggest trouble is that MaskRCNN uses model.save_weights() instead of model.save() to save the keras model(.h5).
Keras2onnx can convert ".h5 files" saved by model.save_weights() to .onnx?

Since MaskRCNN is a wrapper around the keras model, it seems that the code needs to look like the following.

keras2onnx.convert_keras(model.keras_model, name)