Lesson 10.2 · 9 min read · about 55 min to master at a very slow pace
The Convolution Operation
Slide a small filter over the input, multiply and add at each position: that produces a feature map. A full worked example by hand, what the filter detects, channels, and the output-size formula.
The operation
A filter (kernel) is a small grid of learned weights. Place it over a patch of the input, multiply matching values, add them up (plus a bias): that's one output value. Slide it one step and repeat. The grid of outputs is a feature map.
Worked example: 4×4 input, 3×3 filter, stride 1, no padding
Input
| 1 | 2 | 0 | 1 |
| 0 | 1 | 3 | 1 |
| 2 | 1 | 0 | 0 |
| 1 | 0 | 1 | 2 |
Filter (vertical edges)
| 1 | 0 | -1 |
| 1 | 0 | -1 |
| 1 | 0 | -1 |
Feature map
| 0 | 2 |
| -1 | -1 |
Top-left output: the filter covers the highlighted 3×3 patch. Column sums of the patch are , and ; the filter weights the columns , so the output is .
Top-right: columns 2–4 of the top three rows give sums , so . Bottom row (rows 2–4): and .
This filter responds to a vertical edge: brighter on the left than the right gives a positive value. A CNN learns its filter values; early layers typically end up with edge- and colour-detectors like this one.
Channels
A colour image has 3 channels, so each filter is and sums over all three. A layer with 16 filters produces 16 feature maps, which become 16 input channels for the next layer.
Output size
The standard formula, for input size , filter size , padding and stride :
Here , , , : . Padding adds a border (usually zeros) so the output can keep the input's size; stride is the step between positions. Check your course's notation for these before relying on them in an exam.
A naming detail
Deep learning "convolution" is, strictly, cross-correlation: the filter isn't flipped. Since the filter is learned, the difference doesn't matter in practice.
Stuck? Common doubts
Questions real learners asked while studying this lesson. They stay closed so they don't spoil your own thinking: open only the ones you need.
First passIs the same filter really used at every position?
Yes. That's weight sharing: the 9 weights of a 3×3 filter (times the channels) are the only weights it has, reused at every position. Each different filter in a layer has its own weights and produces its own feature map.
Cheatsheet
Convolution
Check your understanding
Score 75% or more to master this lesson and earn XP. Answer first, then check.