DL
    intermediate

    Pooling Layers

    algorithms.live

    Pooling Layers Visualizer
    Position: (0, 0)

    Max Pooling

    Selects the maximum value from each pooling window

    Animation Controls

    Position X
    0

    0/1

    Position Y
    0

    0/1

    Pooling Type
    Max

    Selects maximum value

    Pooling Result

    9
    Maximum

    Input (4×4)

    8346291751387492

    Output (2×2)

    9
    Window ValuesPosition (0, 0)
    8
    3
    2
    9

    Mathematical Intuition: Pooling Operations

    1. Pooling Formulas

    Max Pooling

    yi,j=max⁡m,n∈Wxm,ny_{i,j} = \max_{m,n \in W} x_{m,n}

    Selects maximum value from window

    Average Pooling

    yi,j=1∣W∣∑m,n∈Wxm,ny_{i,j} = \frac{1}{|W|} \sum_{m,n \in W} x_{m,n}

    Computes mean of window values

    Where WW is the pooling window (e.g., 2×2), ∣W∣|W| is window size = 4

    2. Current Window Computation

    Window at position (0, 0):

    Window values:

    8329

    Max Pooling:

    y0,0=max⁡(8,3,2,9)=9y_{0,0} = \max(8, 3, 2, 9) = 9

    3. Output Dimension Formula

    O=⌊I−PS⌋+1O = \left\lfloor \frac{I - P}{S} \right\rfloor + 1

    OO = Output dimension

    II = Input dimension = 4

    PP = Pool size = 2

    SS = Stride = 2

    O=⌊4−22⌋+1=2O = \left\lfloor \frac{4 - 2}{2} \right\rfloor + 1 = 2

    Output: 2 × 2

    Dimensionality reduced by 75%!

    4. Max vs Average Pooling: When to Use?

    Max Pooling (Most Common)

    • Preserves strongest features
    • Better for edge/texture detection
    • More robust to noise
    • Creates sharper feature maps

    Average Pooling

    • Smoother downsampling
    • Preserves overall presence
    • Used in final layers (GAP)
    • Reduces information loss

    5. Why Pooling is Essential in CNNs

    🔹 Translation Invariance

    Small shifts in input → same output. Feature at (10,10) vs (10,11) → pooled to same location

    🔹 Reduces Overfitting

    Fewer parameters in subsequent layers → Harder to memorize training data

    🔹 Computational Efficiency

    4×4 → 2×2 = 75% fewer activations → Faster training & inference

    🔹 Hierarchical Features

    Increases receptive field → Deeper layers see larger portions of input image

    6. Global Average Pooling (GAP)

    y=1H×W∑i=1H∑j=1Wxi,jy = \frac{1}{H \times W} \sum_{i=1}^{H} \sum_{j=1}^{W} x_{i,j}

    GAP pools entire feature map to single value. Often used before final classification layer:

    • No parameters (unlike fully-connected layer)
    • Works with any input size
    • Strong regularization effect
    • Example: 7×7×512 → 1×1×512

    Max Pooling

    Takes the maximum value from pooling window. Best for preserving strongest features and edge detection.

    Average Pooling

    Computes mean of window values. Smoother downsampling, used in final layers and Global Average Pooling.

    Dimensionality Reduction

    4x4 input becomes 2x2 output with 2x2 pooling and stride 2. Reduces spatial dimensions by 75%.

    Translation Invariance

    Provides robustness to small feature shifts. Network recognizes features regardless of exact position.

    What pooling changes

    Sort

    Sort each statement as true or false.

    Tap a piece, then tap where it goes — or drag it. Tap the tray to take one back.

    True of pooling

    Drop items here

    Not true of pooling

    Drop items here
    6 pieces left to place

    Test your knowledge

    20 questions
    Question 1 of 20
    Score: 0

    A pooling layer's main purpose is to…

    Learn these first

    Interview Questions

    Meta
    Apple
    Microsoft
    Google
    NVIDIA
    Amazon
    Google
    Meta
    NVIDIA
    Google Brain
    OpenAI
    Microsoft
    NVIDIA
    Google Health
    Intuitive Surgical

    Love this visualization?

    Sign up to track your progress, earn achievements, use the AI assistant, and access your personal learning dashboard.

    100% free • No credit card required