Global Average Pooling
What You'll Learn
You'll learn how global average pooling reduces entire feature maps to single values, dramatically compressing spatial information before classification.
The Core Idea
While max pooling and average pooling reduce spatial dimensions gradually using small windows (like 2×2), global average pooling (GAP) takes a more extreme approach: it collapses each entire feature map into a single number by computing the average of all values.
If you have a feature map of size 7×7, GAP computes the mean of all 49 values, producing just one output value. If your convolutional layer outputs 256 feature maps, GAP reduces them from (256, 7, 7) to (256,) — a vector of 256 numbers, one per channel.
Why Use Global Average Pooling?
GAP is commonly placed right before the final classification layer because:
- Massive dimensionality reduction: Eliminates all spatial dimensions at once
- No parameters to learn: Unlike fully connected layers, GAP adds zero trainable weights
- Reduces overfitting: Fewer parameters mean less chance of memorizing training data
- Forces spatial invariance: The network learns features that work regardless of position
Analogy: Imagine reading 256 different books (feature maps), each 7 pages long. Instead of remembering every detail, you write one summary score for each book — that's your input to the final decision layer.
When You'll See It
Modern architectures like ResNet and MobileNet use GAP before their classification heads instead of large fully connected layers, keeping models lean and efficient.
Key Takeaway: Global average pooling collapses each feature map to a single value by averaging all spatial positions, providing a parameter-free way to transition from convolutional features to classification outputs.