I have an .h5 file which contains only the weights of a model that has been trained using Mask-RCNN and the Keras framework to perform object detection. I would like to load this model with Tensorflow + Keras in Python and run object detection on custom images.
I am working with Python 3.8.5, and I have tried to load this model using the keras.models.load_model() function, but when trying to do so I receive the error:
ValueError: No model found in config file
I understand this means the .h5 file was saved with only the model weights, and that to make use of those weights I must load them into a model with the same architecture.
I have used the h5py python module to view the groups inside the .h5 file in an attempt to understand the architecture, but I see only keys such as the below: (There are many, many more like this but those are a general overview of the keys I see)
"activation_1", "add_32", "bn2a_branch1", "res5c_out" etc.
These groups sometimes have dataset members, which when accessed, provide information similar to the following:
<HDF5 group "/bn4v_branch2a/bn4v_branch2a" (4 members)\>
<HDF5 dataset "beta:0": shape (256,), type "<f4"\>
<HDF5 dataset "gamma:0": shape (256,), type "<f4"\>
<HDF5 dataset "moving_mean:0": shape (256,), type "<f4"\>
<HDF5 dataset "moving_variance:0": shape (256,), type "<f4"\>
I can assume some things, like "activation_1" probably correspond to activation layers, but the rest of the layers don't seem related to things like Dense, LeakyReLU, BatchNormalization layers, etc. that I'm used to seeing/using when building a model.
What do I need to do here? How can I determine the architecture of a Keras + Mask-RCNN model from an .h5 file with only model weights?
Thank you, any help is greatly appreciated!