Pooling, Strides & Receptive Field
Controlling feature map dimensions and expanding spatial context in convolutional networks.
Key CNN Hyperparameters
As convolutional filters slide across feature maps, three concepts dictate spatial dimensions and information flow:
- Pooling: Downsamples spatial dimensions to compress feature representations.
- Stride: Controls how many pixels the filter jumps at each step.
- Receptive Field: Measures how much of the original input image a deep neuron can see.
1. Pooling Operations
Pooling reduces spatial width and height while keeping feature channel depth constant.
2x2 MAX POOLING (Stride 2):
┌───┬───┐ ┌───┐
│ 1 │ 8 │ ──► Max(1,8,3,4) │ 8 │
├───┼───┤ ──► └───┘
│ 3 │ 4 │
└───┴───┘
- Max Pooling: Takes the single maximum value in a $2 \times 2$ grid. Retains the strongest feature activation while discarding exact position noise.
- Average Pooling: Computes the average value across the grid. Produces smoother downsampling, used frequently in Global Average Pooling layers before final classification.
Key benefits of pooling:
- Cuts memory and compute requirements in half per dimension.
- Provides small translation tolerance (if an object shifts by 1 pixel, max pooling output stays unchanged).
2. Stride and Output Size Formula
Stride is the number of pixels the sliding filter skips between evaluation steps.
- Stride 1: Filter moves 1 pixel at a time (full spatial resolution).
- Stride 2: Filter jumps 2 pixels at a time (cuts output height and width by half).
Spatial Output Size Equation
Given input size $W$, filter size $F$, padding $P$, and stride $S$:
$$W_{\text{out}} = \left\lfloor \frac{W - F + 2P}{S} \right\rfloor + 1$$
Example: Input $32 \times 32$, Filter $3 \times 3$, Padding $1$, Stride $2$:
$$W_{\text{out}} = \left\lfloor \frac{32 - 3 + 2(1)}{2} \right\rfloor + 1 = \left\lfloor \frac{33}{2} \right\rfloor + 1 = 16 + 1 = 16$$
3. Receptive Field
The Receptive Field is the specific area of the original input image that affects a deep neuron activation.
Layer 1 Neuron: Sees a tiny 3x3 patch of raw pixels.
Layer 2 Neuron: Sees a 5x5 patch of raw pixels.
Layer 5 Neuron: Sees a 25x25 patch of raw pixels.
Deep Output Neuron: Sees the ENTIRE 224x224 input image!
To detect large objects (like a truck or building), deep neurons must have a Receptive Field larger than the object itself.
Ways to expand Receptive Field quickly:
- Add more convolutional layers.
- Use Max Pooling or Stride 2 convolutions.
- Use Dilated Convolutions (spacing out filter weights with gaps).
Say this out loud
Max Pooling keeps the strongest activation in a local grid, cutting spatial dimensions in half and providing translation tolerance. Stride controls filter step movement across pixels. Receptive Field measures how much of the original input image a deep neuron can see, expanding with depth, strides, and dilated convolutions to help the network recognize large objects.
Followups to expect
- What is Global Average Pooling (GAP)? Averaging an entire $7 \times 7$ feature map into a single scalar value per channel, replacing huge fully connected layers and preventing overfitting in modern CNNs.
- What is Dilated Convolution (Atrous Convolution)? Inserting spaces between filter elements so a $3 \times 3$ filter covers a $7 \times 7$ spatial area without adding extra trainable parameters.
Check yourself
What is the main purpose of Max Pooling 2x2 with stride 2 in a Convolutional Neural Network?