Answers.Body: <p>We can't see the BatchNorm layer in Netron, so NO. It doesn't have BatchNorm but for good reason. In testing, you don't need BatchNorm (that is the possible reason why it has been done).</p>
  <p>Second, for learning rate, you can't get that because .h5 stores the network and its weights. You don't need learning rate to test or run a model.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-09-20T13:56:53.593Z
Answers.Text: Your main answer seems to be correct, but it seems misleading to state that batchnorm is "not needed" during testing. It is certainly true one often does not want to *update* the batchnorm parameters during testing, but it does not follow that one should remove it - the normalization can still be crucial for the overall network to work if it was trained with batchnorm.
Answers.UserDisplayName: mikkola
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-09-20T18:42:50.937Z
Answers.Text: Could the batchnorm weight and bias be "adopted" to the subsequent layer's parameters? I think it is mathematically possible, but I have no idea whether the framework does that. I guess you could save and reload the model, and check. Actually dropout isn't needed either, don't you just multiply all outputs by a factor when running interference?
Answers.UserDisplayName: NikoNyrh
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-09-19T20:20:19.677Z
Answers.LastActivityDate: 2022-09-19T20:20:19.677Z
Answers.UserDisplayName: Abhishek Verma
Body: <p>I created a CNN model and it is saved in h5 format. I used the <code>Netron</code> app, where I obtained the model architecture, however <code>batchnormalization</code> was not present.</p>
  <p>CNN model:</p>
  <pre><code>model = Sequential()
  model.add(Conv2D(16, (3, 3), input_shape=(height, width, 3), kernel_regularizer=l2(0.001)))
  model.add(Activation('relu'))
  # BatchNormalization()
  model.add(MaxPooling2D(pool_size=(2, 2), strides=(2)))
  
  BatchNormalization()
  
  model.add(Conv2D(32, (3, 3), kernel_regularizer=l2(0.001)))
  model.add(Activation('relu'))
  model.add(MaxPooling2D(pool_size=(2, 2), strides=(2)))
  
  BatchNormalization()
  model.add(Dropout(.5))
  
  model.add(Conv2D(32, (3, 3), kernel_regularizer=l2(0.001)))
  model.add(Activation('relu'))
  model.add(MaxPooling2D(pool_size=(2, 2), strides=(2)))
  
  BatchNormalization()
  model.add(Dropout(.3))
  
  model.add(Conv2D(64, (3, 3), kernel_regularizer=l2(0.001)))
  model.add(Activation('relu'))
  model.add(MaxPooling2D(pool_size=(2, 2), strides=(2)))
  
  BatchNormalization()
  model.add(Dropout(.3))
  
  model.add(Flatten())
  
  model.add(Dense(256))
  model.add(Activation('relu'))
  
  model.add(Dropout(.5))
  
  model.add(Dense(4,activation='softmax'))
  </code></pre>
  <p>The output of Netron app:</p>
  <p><a href="https://i.sstatic.net/nOUh3.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/nOUh3.png" alt="enter image description here" /></a></p>
  <p>I have saved this model in h5 format. Is there a method to determine whether this h5 model has a <code>batchnormalization</code> layer or not. Again, is it possible to know the learning rate?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-09-18T23:08:24.677Z
Comments.Text: Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
Comments.UserDisplayName: Community
Tags: <convolutional-neural-networks><tensorflow><keras>
Title: What data can I obtain from CNN model (H5 file)?
UserDisplayName: Rezuana Haque
ThreadText: # What data can I obtain from CNN model (H5 file)?
  
  (Asked by: username_0 on 2022-09-18)
  
  I created a CNN model and it is saved in h5 format. I used the Netron app, where I obtained the model architecture, however batchnormalization was not present.
  CNN model:
  model = Sequential()
  model.add(Conv2D(16, (3, 3), input_shape=(height, width, 3), kernel_regularizer=l2(0.001)))
  model.add(Activation('relu'))
  # BatchNormalization()
  model.add(MaxPooling2D(pool_size=(2, 2), strides=(2)))
  
  BatchNormalization()
  
  model.add(Conv2D(32, (3, 3), kernel_regularizer=l2(0.001)))
  model.add(Activation('relu'))
  model.add(MaxPooling2D(pool_size=(2, 2), strides=(2)))
  
  BatchNormalization()
  model.add(Dropout(.5))
  
  model.add(Conv2D(32, (3, 3), kernel_regularizer=l2(0.001)))
  model.add(Activation('relu'))
  model.add(MaxPooling2D(pool_size=(2, 2), strides=(2)))
  
  BatchNormalization()
  model.add(Dropout(.3))
  
  model.add(Conv2D(64, (3, 3), kernel_regularizer=l2(0.001)))
  model.add(Activation('relu'))
  model.add(MaxPooling2D(pool_size=(2, 2), strides=(2)))
  
  BatchNormalization()
  model.add(Dropout(.3))
  
  model.add(Flatten())
  
  model.add(Dense(256))
  model.add(Activation('relu'))
  
  model.add(Dropout(.5))
  
  model.add(Dense(4,activation='softmax'))
  
  The output of Netron app:
  
  I have saved this model in h5 format. Is there a method to determine whether this h5 model has a batchnormalization layer or not. Again, is it possible to know the learning rate?
  
  **Tags:** convolutional-neural-networks, tensorflow, keras
  > **Comments:**
  > **username_1**: Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2022-09-19. Score: 1 | Accepted answer
  
  We can't see the BatchNorm layer in Netron, so NO. It doesn't have BatchNorm but for good reason. In testing, you don't need BatchNorm (that is the possible reason why it has been done).
  
  Second, for learning rate, you can't get that because .h5 stores the network and its weights. You don't need learning rate to test or run a model.
  
  > **Comments:**
  > **username_3**: Your main answer seems to be correct, but it seems misleading to state that batchnorm is "not needed" during testing. It is certainly true one often does not want to *update* the batchnorm parameters during testing, but it does not follow that one should remove it - the normalization can still be crucial for the overall network to work if it was trained with batchnorm.  
  > **username_4**: Could the batchnorm weight and bias be "adopted" to the subsequent layer's parameters? I think it is mathematically possible, but I have no idea whether the framework does that. I guess you could save and reload the model, and check. Actually dropout isn't needed either, don't you just multiply all outputs by a factor when running interference?  
  
  ---
  
  