Course contentsShow
← Machine Learning and Deep Learning
Lesson 872 of 3,53820. Convolutional Neural Networks: FundamentalsFree lesson

Global Average Pooling

Learn how global average pooling collapses entire feature maps to single values, commonly used before classification layers.

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:

  1. Massive dimensionality reduction: Eliminates all spatial dimensions at once
  2. No parameters to learn: Unlike fully connected layers, GAP adds zero trainable weights
  3. Reduces overfitting: Fewer parameters mean less chance of memorizing training data
  4. 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.