Average pooling is a downsampling operation in convolutional neural networks that replaces each window of a feature map with the average of its values. It has no learnable parameters and it shrinks the height and width of the input while keeping the channels.
This page is for data scientists and engineers building or reviewing CNNs. It covers what average pooling is, how it works, how it differs from max pooling and what global average pooling adds.
In Keras documentation, the AveragePooling2D layer is described as downsampling the input along its spatial dimensions (height and width) by taking the average value over an input window for each channel of the input. The window is shifted by the stride along each dimension.
The Dive into Deep Learning textbook adds that pooling layers have no kernel or learnable parameters, so they are deterministic. Average pooling outputs the mean of each window, while max pooling outputs the largest value.
According to Dive into Deep Learning, pooling helps mitigate the sensitivity of convolutional layers to location and spatially downsamples the representation. Reducing resolution also lets each hidden unit's receptive field grow faster with depth.
Pooling works on each channel separately, so the output has the same number of channels as the input.
Take a window, such as 2 by 2, and slide it across the feature map. At each position, output the mean of the values inside. Three settings control the result.
For a worked case, a 3 by 4 input with a 2 by 2 window and stride 2 under valid padding gives a 1 by 2 output. The Keras page shows this example, and its values are 3.5 and 5.5.
| Question | Average pooling | Max pooling |
|---|---|---|
| What does it output? | The mean of each window | The largest value in each window |
| What does it keep? | A smoothed summary of the whole window | The strongest activation in the window |
| Learnable parameters? | None | None |
| Current preference | Used mainly in older CNN architectures and in global form near the output | Dive into Deep Learning calls it preferable in almost all cases |
The choice is empirical. Try both on your own data and compare validation results.
Global average pooling takes the average over a whole feature map, giving one value per channel. The Network In Network paper proposed using it in the classification layer in place of fully connected layers, and its abstract says this is easier to interpret and less prone to overfitting than traditional fully connected layers.
Pooling sits inside the perception models that agents may call, such as image classifiers used in inspection or document workflows. The agent does not see the pooling layer, but its choice affects how the model summarises an image. Teams assembling agents with vision models can read about ElixirClaw, the AI agents computing platform from XenonStack.
To map one decision your agents make, and the data and policy it depends on, book a Context Workshop. See what happens in the workshop.
Average pooling downsamples a feature map by taking the average value over each window of the input, separately for each channel.
No. Pooling layers have no kernel or learnable parameters, so they are deterministic.
Not generally. Dive into Deep Learning calls max pooling preferable to average pooling in almost all cases, but you should compare both on your own data.
Global average pooling averages each whole feature map into a single value per channel. The Network In Network paper proposed it as a replacement for fully connected classification layers.
Pooling reduces the sensitivity of convolutional layers to location and downsamples the representation, which also lets receptive fields grow faster with depth.