4
$\begingroup$

I want to use batch normalization layer to decrease overfitting in VGG16 CNN.

Where should the batch normalization layer be added to the network?

`_________________________________________________________________
Layer (type)                 Output Shape              Param #   
=================================================================
input_1 (InputLayer)         (None, 224, 224, 3)       0         
_________________________________________________________________
block1_conv1 (Conv2D)        (None, 224, 224, 64)      1792      
_________________________________________________________________
block1_conv2 (Conv2D)        (None, 224, 224, 64)      36928     
_________________________________________________________________
block1_pool (MaxPooling2D)   (None, 112, 112, 64)      0         
_________________________________________________________________
block2_conv1 (Conv2D)        (None, 112, 112, 128)     73856     
_________________________________________________________________
block2_conv2 (Conv2D)        (None, 112, 112, 128)     147584    
_________________________________________________________________
block2_pool (MaxPooling2D)   (None, 56, 56, 128)       0         
_________________________________________________________________
block3_conv1 (Conv2D)        (None, 56, 56, 256)       295168    
_________________________________________________________________
block3_conv2 (Conv2D)        (None, 56, 56, 256)       590080    
_________________________________________________________________
block3_conv3 (Conv2D)        (None, 56, 56, 256)       590080    
_________________________________________________________________
block3_pool (MaxPooling2D)   (None, 28, 28, 256)       0         
_________________________________________________________________
block4_conv1 (Conv2D)        (None, 28, 28, 512)       1180160   
_________________________________________________________________
block4_conv2 (Conv2D)        (None, 28, 28, 512)       2359808   
_________________________________________________________________
block4_conv3 (Conv2D)        (None, 28, 28, 512)       2359808   
_________________________________________________________________
block4_pool (MaxPooling2D)   (None, 14, 14, 512)       0         
_________________________________________________________________
block5_conv1 (Conv2D)        (None, 14, 14, 512)       2359808   
_________________________________________________________________
block5_conv2 (Conv2D)        (None, 14, 14, 512)       2359808   
_________________________________________________________________
block5_conv3 (Conv2D)        (None, 14, 14, 512)       2359808   
_________________________________________________________________
block5_pool (MaxPooling2D)   (None, 7, 7, 512)         0         
_________________________________________________________________
flatten (Flatten)            (None, 25088)             0         
_________________________________________________________________
fc1 (Dense)                  (None, 4096)              102764544 
_________________________________________________________________
fc2 (Dense)                  (None, 4096)              16781312  
_________________________________________________________________
predictions (Dense)          (None, 1000)              4097000   
=================================================================`
$\endgroup$
1
  • 1
    $\begingroup$ Inorder to reduce over fitting of data you need to add more dropout layer. This is based on N.Srivastava's journal named "Dropout: A Simple Way to Prevent Neural Networks from Overfitting". Please check it for more information. $\endgroup$ Aug 12, 2019 at 0:23

2 Answers 2

2
$\begingroup$

Why BN?

  1. 10x or more improvement in training speed
  2. Reduce overfitting

Where to apply BN?

Batch Normalization is usually inserted after fully connected layers or Convolutional layers and before non-linearity, Here is an example of applying batch normalization to my VGG19 network:

enter image description here

$\endgroup$
1
$\begingroup$

The main purpose of batch normalisation is not for dealing with overfitting but if you have small batches while training it can have regularization effect. In the paper that it was introduced for dealing with covariat shift, it was mentioned that it should be used before activation function. Consequently, you can use it both in convolutional layers and dense layers, after employing weights and before activation functions. But I've seen people using that after activation function. It can also be used there.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.