3.4.3 · D1Convolutional Neural Networks

Foundations — Pooling layers (max, average)

3,100 words14 min readBack to topic

Before you can read a single formula in the parent note, you need to know what each little symbol is. This page builds every one of them from nothing. Read top to bottom — each idea is used by the next.


0. What is a "feature map"? (the grid we pool)

Everything in pooling happens on a grid of numbers. This whole subject lives inside a CNN — a Convolutional Neural Network, a kind of image-processing network that stacks convolution and pooling steps. Inside a CNN this grid is called a feature map, but for now just picture a spreadsheet of numbers.

Figure — Pooling layers (max, average)

Why does the topic need this? Because pooling is nothing but an operation on such a grid — the input goes in as a grid, and a smaller grid comes out. If you don't picture the grid first, none of the symbols land anywhere. These grids are produced by convolutional layers before pooling touches them.


1. Height and width: and (and the input/output tags)

The grid has a number of rows and a number of columns.

Look at the figure above: it is rows tall and columns wide, so and . We say the grid is , read " by ".

Pooling turns a bigger grid into a smaller one, so we need to distinguish the two:

Why the topic needs them: the output-size formula computes , from , . Without the tags you couldn't tell which height the formula is talking about.


2. Naming a single cell: and the subscript idea

We need a way to point at one specific cell and say "that number, right there."

Figure — Pooling layers (max, average)

Because rows are numbered up to one less than the count, the indices have a valid range:

Why the topic needs it: every pooling formula is a rule that says "take these particular cells and combine them." To say which cells, you must be able to name a cell. is that naming tool.


2b. Many grids stacked: the channel count

Real feature maps are not one grid but a stack of grids, one per detected feature.


3. The pooling window:

We never summarise the whole grid at once — we summarise it patch by patch. The patch is a small square.

Picture a cardboard frame you lay over the grid. Only the cells inside the frame get combined into one output number. This frame idea is closely tied to the receptive field — the region of input one output neuron "sees."

Why the topic needs it: decides how many cells collapse into one, which controls how much the grid shrinks and how "local" the summary is.


4. Moving the window: stride

After summarising one patch, we slide the frame over and do the next patch. How far we slide is the stride.

Figure — Pooling layers (max, average)
  • If the frames sit side by side, never overlapping (the usual case).
  • If the frames overlap — some cells get used by more than one window.
  • If the frames leave gaps — some cells are skipped entirely.

This exact same is the stride you meet in stride and padding for convolutions.

Why the topic needs it: controls where each window starts. That is why it appears inside the formula as — see below.


5. Reading (the address of a windowed cell)

This is the scariest-looking symbol in the parent note. Let's earn it piece by piece.

We have two coordinate systems now:

  • = which output cell we are building (row/column in the small result grid),
  • = which cell inside the window, starting at the window's top-left corner ( down, right, both from ).

The window-local indices only run across the window, so their range is fixed by :

Read it as a two-step walk:

  1. jumps to where output cell 's window starts (stride times the output index).
  2. then steps inside that window to the cell we want.

Why the topic needs it: without this address formula you cannot say which input cells feed which output cell. It is the bridge between the small output grid and the big input grid.


6. The output grid and the two summary operations: and the average

We named the input grid . The result of pooling is a new, smaller grid — we give it its own name.

Now the actual summarising.

Putting the address formula together with each summary gives the two complete pooling rules:

Figure — Pooling layers (max, average)

Why these two? Because a feature map's numbers mean "how strongly a feature is present."

  • answers "is the feature present anywhere in this patch?" — keep the peak.
  • Average answers "how much feature is here on the whole?" — smooth blend.

That is the entire distinction the parent note builds on. Average pooling that summarises an entire map at once is global average pooling.


7. The floor brackets and the size formula

The output-size formula is . One new symbol: the floor.

Why the topic needs it: a window can only sit on the grid if it fits completely. A fractional number of windows is impossible — you can't have patches. Rounding down throws away the leftover strip that no full window can cover.

Where does the come from? Count the starting positions the window can take.

The same reasoning runs left-to-right for the columns, so there are two size formulas — one per direction:


Prerequisite map

Grid of numbers = feature map

Height H and Width W

Input vs output sizes

Channel count C

Cell address X sub i j

Window size p

Stride s

Windowed address i times s plus m

max and average summaries

Output grid Y

Floor and plus one in size formula

Pooling layers


Equipment checklist

Test yourself — cover the right side and answer before revealing.

What does one number inside a feature map mean?
How strongly the detected feature is present at that cell — big = strongly present.
What does the acronym CNN stand for?
Convolutional Neural Network.
What is the difference between and ?
is the input (pre-pooling) height; is the output (post-pooling) height.
In , what are and and what ranges do they take?
is the row and the column; and .
What is the top-left cell of grid called?
(counting starts at zero, not one).
What is the channel count , and what does pooling do to it?
The number of stacked feature-map grids; pooling acts on each channel independently and leaves unchanged.
What does stand for, what values may it take, and what range do take?
is the window side length, a positive whole number; and each run to ( values), giving cells.
What does the stride control and what values may it take?
How many cells the window slides between patches; a positive whole number, with meaning non-overlapping.
What does compute?
The input row address = jump to window start () then step inside ().
What is the grid and what is ?
is the pooled output grid; is the single summary number replacing the window at output position .
Write the complete max-pooling formula.
.
Write the complete average-pooling formula.
.
How do you turn a over a window into an average?
Divide the sum by the number of cells, i.e. multiply by .
Where does the in the size formula come from?
It counts the first window at start position ; the floored quotient counts the gaps between starts, and there is always one more start than gaps.
What are BOTH output-size formulas, and what do they assume about padding?
and ; they assume no padding ().
What must be true for pooling to be defined, and what happens if ?
You need (and ); if the window is bigger than the grid no valid window fits and pooling is undefined without padding.