title: Is there a way to determine model architecture from a .h5 file?
body: <p>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.</p>
  <p>I am working with Python 3.8.5, and I have tried to load this model using the <code>keras.models.load_model()</code> function, but when trying to do so I receive the error:</p>
  <blockquote>
  <p>ValueError: No model found in config file</p>
  </blockquote>
  <p>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.</p>
  <p>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)</p>
  <blockquote>
  <p>&quot;activation_1&quot;, &quot;add_32&quot;, &quot;bn2a_branch1&quot;, &quot;res5c_out&quot; etc.</p>
  </blockquote>
  <p>These groups sometimes have dataset members, which when accessed, provide information similar to the following:</p>
  <pre><code>&lt;HDF5 group &quot;/bn4v_branch2a/bn4v_branch2a&quot; (4 members)\&gt;  
  &lt;HDF5 dataset &quot;beta:0&quot;: shape (256,), type &quot;&lt;f4&quot;\&gt;  
  &lt;HDF5 dataset &quot;gamma:0&quot;: shape (256,), type &quot;&lt;f4&quot;\&gt;  
  &lt;HDF5 dataset &quot;moving_mean:0&quot;: shape (256,), type &quot;&lt;f4&quot;\&gt;  
  &lt;HDF5 dataset &quot;moving_variance:0&quot;: shape (256,), type &quot;&lt;f4&quot;\&gt;
  </code></pre>
  <p>I can assume some things, like &quot;activation_1&quot; 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.</p>
  <p>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?</p>
  <p>Thank you, any help is greatly appreciated!</p>