Pooling Layers
In the previous lesson, we learned how convolution extracts meaningful patterns from an image using filters.
Now we introduce the next critical operation in CNNs — pooling.
Pooling helps the network reduce size, focus on important features, and become more robust.
Why Pooling Is Needed
After convolution, feature maps still contain a lot of spatial information.
If we keep processing full-size feature maps, the network becomes:
• Computationally expensive • Sensitive to small position changes
Pooling solves this by summarizing nearby information.
What Is Pooling?
Pooling is a downsampling operation.
Instead of learning weights, pooling applies a fixed mathematical function over small regions of a feature map.
This reduces width and height while preserving important patterns.
Max Pooling (Most Common)
Max pooling selects the maximum value from a region.
This keeps the strongest activation and ignores weaker responses.
Max pooling works well because:
• Strong features matter most • Exact location becomes less important
Conceptual Example
Suppose we have a 2 × 2 pooling window:
Feature map region:
[1 3
2 0]
Max pooling output:
3
Only the strongest signal survives.
Average Pooling
Average pooling computes the average value within a region.
It smooths the feature map instead of selecting peaks.
Average pooling is useful when:
• Overall intensity matters • Noise reduction is important
Stride and Pool Size
Pooling also uses:
• Pool size (window size) • Stride (movement step)
A common configuration:
2 × 2 pool size with stride 2
This reduces feature map dimensions by half.
Pooling in Code
Let us see how pooling layers are defined.
from tensorflow.keras.layers import MaxPooling2D
pool_layer = MaxPooling2D(
pool_size=(2,2),
strides=2
)
This layer:
• Takes 2 × 2 regions • Keeps only the maximum value • Moves two pixels at a time
Why Pooling Improves Robustness
Real-world images are not perfectly aligned.
Objects may shift slightly, rotate, or appear at different positions.
Pooling helps CNNs:
• Ignore small translations • Focus on presence of features • Generalize better
Does Pooling Lose Information?
Yes — pooling intentionally loses some spatial detail.
But this is a trade-off:
Less detail, but better generalization and efficiency.
Modern architectures carefully balance convolution and pooling depth.
Mini Practice
Think about this:
Why would max pooling work better than average pooling for detecting edges?
Exercises
Exercise 1:
What is the main purpose of pooling layers?
Exercise 2:
Why does max pooling help with translation invariance?
Quick Quiz
Q1. Does pooling learn weights?
Q2. Which pooling method keeps strongest activations?
In the next lesson, we will learn how padding and stride control spatial dimensions and why padding is critical for deep CNN architectures.