✎ Edit content·DAY 044 · POST 3 OF 5 · How It Works

Convolutional Neural Networks

Deep Learning · 12 slides
DAY 044 · POST 3 OF 5
(REMINDER)
DAY 044
Convolution, Traced Step by Step
@saurav_dnj_24github.com/SauravDnj · linkedin.com/in/sauravdnj
1 / 12

Theme

Palette

Download

4K — sharpest, slowest
🎬 Video options
Preparing preview…
Live preview · loops the “none” effect
All rendering runs in your browser. No server, no cost, no upload. MP4/WebM = full motion + effects · GIF = lightweight loop · PNG/PDF = static for the Instagram & LinkedIn carousel.

Caption (tap to copy)

📖 Deep dive (full written explanation)

The slides stay clean and scannable. Here's the in-depth explanation behind each one — great for the blog version, show notes, or studying the topic properly.
Slide 1 · Convolution, Traced Step by Step

This cover frames post 3 as the engine room, signaling a shift from motivation to mechanism. The promise — one small filter, slid across an image patch by patch, producing a feature map — tells the reader the payoff is a concrete trace they can follow, not more abstraction.

The key reframing is that convolution, despite its intimidating name, is just sliding a tiny grid and multiplying. Doing the operation by hand on a small example is the fastest way to demystify it, because every multiply and every sum is visible. By the end, every argument to nn.Conv2d will mean something specific.

Slide 2 · Step 1: one window

Step 1 isolates the atomic operation: place the filter over one patch, multiply each weight by the pixel beneath it, and sum the products into a single output number. That dot product between filter and patch is the entire convolution operation; everything else is just repeating it.

The interpretation matters as much as the arithmetic. A large output means the patch strongly resembles the pattern the filter encodes, so the filter acts as a pattern detector and its output measures match strength. Grounding the operation in 'how much does this patch look like what I'm searching for' gives the reader meaning to attach to the numbers, not just a formula.

Slide 3 · Step 2: slide and repeat

Step 2 turns one window into a full feature map by sliding. Shift the filter one position right, repeat the multiply-and-sum, continue across the row and down the rows until the whole image is covered. Each position contributes one output value, and collected together they form a 2D grid.

Naming that grid a feature map and describing it as a heat map of where the pattern appears is the conceptual payoff. The filter answers 'is the pattern here?' at every location, and the feature map is the spatial record of those answers. This directly reinforces the post 1 distinction between the small filter and the large map it produces.

Slide 4 · The sliding window

The pipeline diagram distills the convolution operation into its four moves: take a patch, multiply weights by pixels, sum to one number, and slide everywhere to build the feature map. It is the visual companion to steps 1 and 2, compressing the trace into a single portable image.

Presenting it as a pipeline emphasizes that convolution is a disciplined sequence repeated at every location, not a single complicated formula. A reader who internalizes these four icons can mentally execute convolution on any patch, which is exactly the intuition the by-hand code slide then makes literal.

Slide 5 · Step 3: stride and padding

Step 3 introduces the two knobs that control convolution's geometry. Stride is the jump size: stride 1 slides one pixel at a time with heavy overlap, while stride 2 skips every other position and roughly halves the output. Padding adds a border of zeros so the filter can center on edge pixels.

The practical effect ties the two together. Without padding, every convolution shrinks the image slightly, which compounds badly over many layers; padding lets you keep the size constant. Stride lets you deliberately downsample inside the convolution itself. Understanding both is what lets a reader predict and control output sizes, which the formula slide makes exact.

Slide 6 · The output-size formula

This code slide makes output sizing precise with the standard formula: output equals floor of (W minus K plus 2P) divided by S, then plus one. The two worked examples show the two cases that matter most — same-size convolution with padding 1 and stride 1, and halving with stride 2.

This formula is the antidote to the single most common CNN bug, the shape mismatch that post 5 leads with. A reader who can compute output sizes by hand can lay out an architecture confidently and predict exactly what the flattened vector size will be before the final dense layer, rather than discovering it through a runtime error.

Slide 7 · Step 4: channels add depth

Step 4 adds the dimension beginners most often miss: channels. A color image has three channels, so a 3x3 filter is really 3x3x3 and sums its products across all three at once, still producing a single feature map. Using many filters produces many maps stacked into a depth dimension.

The recursion is the key insight. If a layer uses 16 filters it outputs a 16-deep tensor, and the next layer's filters convolve across all 16 channels, combining simpler patterns into richer ones. This channel-stacking is the mechanical basis of the feature hierarchy from post 1 — depth in channels is how parts get built from edges.

Slide 8 · Step 5: ReLU, then pool

Step 5 covers the two operations that almost always follow convolution. A ReLU zeros out negative responses, keeping only the locations where the pattern actually fired, which adds the nonlinearity the network needs to learn complex functions. Then pooling, usually 2x2 max, keeps the strongest value in each small window.

Pooling does three things at once: it halves width and height, discards fine detail to focus on what matters, and makes the features robust to small shifts, since the maximum in a window survives a one-pixel translation. This is the concrete source of the partial translation invariance that post 1 listed as a defining property.

Slide 9 · Convolution by hand

This code slide implements convolution by hand with explicit loops so nothing is hidden. A small image and a 2x2 filter are defined, then a double loop walks every valid window, extracts the patch, multiplies it elementwise by the filter, and sums to fill the output. The result is a feature map computed from scratch.

Using plain numpy loops rather than a framework call is deliberate. The reader sees that nn.Conv2d is doing exactly this multiply-and-sum at every position, just vectorized and optimized. Running it and changing the filter values builds intuition for how different filters detect different patterns, which is the bridge from the mechanics here to the trainable layers in post 4.

Slide 10 · One conv block, end to end

The flow diagram shows one complete conv block end to end: an input tensor of height, width, and channels enters; convolution slides its filters; ReLU keeps the positive responses; pooling applies 2x2 max; and out comes a smaller map, typically with more channels than it went in with.

This is the unit that gets stacked to build a real CNN. Seeing the block as a single repeatable module clarifies the pattern post 4 implements twice in code — conv, ReLU, pool, repeat — and explains the characteristic shape of a CNN: spatial dimensions shrinking while channel depth grows, trading where for what.

Slide 11 · The mechanics, in order

The recap orders the mechanics into the exact sequence the trace followed: multiply and sum over each window, slide everywhere to build a feature map, use stride to skip and padding to preserve size, add one output channel per filter, and finish with ReLU to keep positives and pooling to shrink. Reciting this is enough to reason about any conv layer.

This ordered list doubles as a study aid for post 4, where these steps appear as PyTorch layers. A reader who can recite the mechanics can read the architecture code and recognize each line, rather than treating Conv2d, ReLU, and MaxPool2d as opaque calls.

Slide 12 · Save this. Follow for Day 45.

The CTA transitions from a by-hand trace to a full runnable build. Having seen how one filter slides and how a conv block is structured, the reader is primed to assemble those blocks into a real CNN in PyTorch and train it on actual images.

Naming the deliverable — a working classifier built layer by layer — sets a concrete expectation that post 4 is buildable and runnable, which is the right reward after working through the mechanics.

🎨 AI image prompt (matches this theme + palette)

Paste into Midjourney, DALL·E, Ideogram, etc. to generate an on-brand image, then upload it on the Edit content page. The prompt updates automatically with the selected theme + palette.