Playground / Convolution

Move the kernel across the image

Convolution

Interactive lab

Try it: Convolution

How a convolution layer slides a small kernel over an image, multiplying and summing at each position to build a feature map.

How it works

  1. Place the 3×3 kernel over the top-left 3×3 window of the input.
  2. Multiply each input value by the kernel weight on top of it and add the nine products — that sum is one output cell.
  3. Slide the window by the stride and repeat until every position is covered.
  4. Zero padding adds a border so edge pixels are covered too; output size = ⌊(n + 2p − k) / s⌋ + 1.

Default run (11 steps): 5×5 input, 3×3 kernel, stride 1. Output is ⌊(5 + 2×0 − 3) / 1⌋ + 1 = 3 per side. … Done: the kernel visited all 9 positions and produced a 3×3 feature map.

Simplified: One 5×5 single-channel input and one 3×3 kernel. As in deep-learning libraries, the kernel is not flipped (strictly, cross-correlation).

Educational simulation

Loading the simulation…