Batch normalization is a neural-network layer that normalizes intermediate activations, helping convolutional models generalize and reducing memorization. section 7.1.1 section 8.1.4
For each convolutional feature map, it calculates the mean and variance, subtracts the mean, and divides by the square root of the variance. Values therefore remain centered near zero, reducing vanishing and exploding gradient problems. section 8.1.4
Adding the layer to a CNN
A Keras CNN places BatchNormalization between convolution and max pooling. A comparable autoencoder adds the layer throughout both encoder and decoder, alongside dropout; excessive use can worsen results and require manual architecture tuning. section 7.1.1 section 8.1.5
Listing 7.6 EDL_7_1_Keras_CNN.ipynb: Adding pooling
model = models.Sequential() model.add(layers.Conv2D(64, (3, 3), activation='relu', padding="same", input_shape=(28, 28, 1))) #1 model.add(layers.BatchNormalization()) #2 model.add(layers.MaxPooling2D((2, 2), padding="same")) #3 model.add(layers.Flatten()) model.add(layers.Dense(128, activation='relu')) model.add(layers.Dense(10)) model.summary() ... ================================================================= Total params: 1,607,946 Trainable params: 1,607,818 #4 Non-trainable params: 128 _________________________________________________________________
Inspect a runnable Keras CNN showing BatchNormalization placement, pooling, and parameter counts. section 7.1.1
Use the figure to inspect per-feature-map means, variances, and normalized values. section 8.1.4








