← Neural NetworksToolsInVisionLearning Center
Convolutional Neural Networks · Lesson 52

Average Pooling and Max Pooling

Compare maximum and average pooling with worked numerical examples and a solar-inspection analogy.

Watch the lesson

Average Pooling and Max Pooling explained visually

2:24

Compare maximum and average pooling with worked numerical examples and a solar-inspection analogy.

Lesson overview

What you will learn

Follow filters, pooling, flattening, and classification through complete CNN examples.

  1. Distinguish a peak from an overall level
  2. Work through the same input twice
  3. Compare output shape and retained information
  4. Choose according to the task
01

Distinguish a peak from an overall level

A thermal inspection might ask whether a solar-panel region contains a hotspot or is warm overall. These are different questions. The analogy explains two summaries; neural-network feature values do not have to be temperatures.

Max pooling selects the largest response. Average pooling sums the values in the pooling region and divides by their count.

02

Work through the same input twice

For a 2 × 2 region containing 2, 4, 6, and 8, max pooling returns 8. Average pooling returns (2 + 4 + 6 + 8) ÷ 4 = 5.

For a second region containing 0, 0, 0, and 8, the maximum is still 8, but the average is 8 ÷ 4 = 2. The same peak can coexist with very different surrounding values.

03

Compare output shape and retained information

With the same spatial window, stride, padding, and output-size conventions, both operations can produce outputs with the same dimensions. Their values differ because they use different summary rules.

Both operations summarize multiple inputs. Max pooling emphasizes a peak; averaging includes contributions from every value in the region. Neither generally preserves all original values.

04

Choose according to the task

Neither operation knows whether an isolated strong response is useful evidence or unwanted noise. That depends on the learned representation, the data, and the application.

Evaluate the architecture on suitable validation data. After spatial processing, a feature map can be reorganized for a fully connected layer using flattening.

Knowledge check

Quick check: test your understanding

What are the maximum and average of 2, 4, 6, and 8?

Maximum: 8. Average: 5.

What are the maximum and average of 0, 0, 0, and 8?

Maximum: 8. Average: 2.

Can max pooling identify whether a peak is noise?

No. Selecting the largest number does not determine whether it is useful evidence.

Accessible referenceLesson 52 transcript308 words · Matches the published narration and captionsOpen transcript

Imagine inspecting solar panels with a thermal camera. One question is whether a small area contains a strong hot spot. Another question is whether the whole area is warm overall. These questions suggest two different ways to summarize a region. Max pooling keeps its largest value. Average pooling calculates the average of its values.

The temperature example is only an analogy. Inside a neural network, feature map values represent learned responses. They do not have to represent temperature. Consider a pooling window containing two, four, six, and eight. Max pooling returns eight because eight is the largest value. Average pooling adds the four values. Their total is twenty. Dividing twenty by four gives five, so the average pooling output is five.

Both methods replace four numbers with one number. However, the numbers describe different properties of the region. Now consider another window. It contains zero, zero, zero, and eight. Max pooling still returns eight. Average pooling returns two because eight divided by four is two. The strongest response has stayed the same, but the average response has become smaller.

Max pooling can preserve a strong response even when nearby responses are weak. Average pooling reflects the contributions of all values in the window, so an isolated response has less influence on the result. Neither method can decide by itself whether a strong response is useful evidence or unwanted noise. That depends on the features the network has learned and the task it is trying to perform.

When their window size, stride, and padding match, the two methods can produce outputs with the same spatial dimensions. The difference is how they summarize the values. Choosing between them requires evaluating the network on relevant data. The best choice depends on the application. In the next lesson, we will see how flattening rearranges feature maps into a single list of features.