Chapter 07 • Computer Vision

Seeing Patterns (CNNs)

If a cat moves two inches to the left in a photo, it's still a cat. Vision networks learn to see by sliding tiny pattern-flashlights across the entire image.

⏱ ~10 min read 🎛️ 2 Interactive Playgrounds 📐 Zero Equations

The Trap of Memorizing Pixel Addresses

Pause and picture a photograph of a cat sitting on a windowsill. To your eyes, the cat pops out effortlessly — pointy ears, bright eyes, curved whiskers. To a computer, however, that photo starts out as nothing more than a flat grid of tiny colored light bulbs called pixels.

Now imagine wiring a plain network from earlier chapters directly to every single pixel in the photo. Each neuron would stare at fixed pixel addresses — essentially memorizing rules like, "If pixel #412 is bright and pixel #413 is dark, maybe that's an ear!"

Here is the problem: what happens if the cat walks just two inches to the left? Suddenly, every single pixel in the photo changes brightness. The ear is no longer at pixel #412 — it's sitting at a completely different address. A pixel-memorizing network would have to re-learn what a cat looks like at hundreds of separate locations across the frame. Even worse, wiring every pixel to every neuron requires millions of extra dials to tune.

Human vision doesn't work like that at all. You don't have a special "top-left corner ear detector" and a separate "bottom-right corner ear detector." You know what a pointy ear looks like anywhere in your field of view.

The Sliding Pattern-Flashlight

Convolutional Neural Networks — or CNNs — solve this with one beautifully simple idea. Instead of trying to swallow the entire image in one giant gulp, give the network a tiny 3×3 pattern-flashlight (often called a filter).

Each flashlight is tuned to hunt for just one simple visual clue — maybe a crisp vertical line, a flat horizontal edge, a sharp corner, or a lone glowing dot. Then, the network slides that exact same flashlight step-by-step across every neighborhood of the picture.

At every stop, the flashlight asks a single question: "How closely does this tiny patch match the pattern I'm looking for?" Wherever it finds a strong match, it paints a glowing hotspot onto a brand-new grid called a Feature Map — a treasure map showing everywhere that pattern appears in the image.

Playground 1 The Sliding Pattern-Flashlight (Convolution Scanner)
Drag gold 3×3 flashlight • Click any pixel to paint/erase
Picture:
Flashlight:
Active Flashlight
Vertical Edge Finder
Match at Current Spot
92% — Strong Vertical Edge!
Brightest Hotspots Found
8 strong matches
Pause & Play — Watch One Picture Become Four Different Maps

Start with the House preset and click Auto-Scan. With the Vertical Edge Finder active, watch the Feature Map light up exclusively along the house's left and right walls. Now switch to the Horizontal Edge Finder — the walls go dark, and the roofline and floor glow instead! Next, switch to Smiley Face with the Bright Spot Finder and watch the two eyes pop out like twin stars. Finally, click a few dark pixels to paint your own chimney or eyebrow and notice how the Feature Map updates instantaneously.

Stacking Flashlights: From Raw Pixels to Whole Objects

A single flashlight only sees tiny, local clues — a slant here, a corner there. Looking at one edge alone could never tell you whether you're staring at a cat's ear or a car's windshield.

So how does a vision network make the leap from simple strokes to full understanding? It performs a wonderfully recursive trick: it shines a second layer of flashlights across the Feature Maps of the first layer!

Pause and watch this hierarchy unfold in your mind:

  • Layer 1 (Simple Edges): Looks directly at raw pixels and spots tiny vertical, horizontal, and diagonal strokes.
  • Layer 2 (Corners & Curves): Looks at where Layer 1's edges meet — spotting sharp angles, gentle arcs, and circular rims.
  • Layer 3 (Recognizable Parts): Combines curves and corners into meaningful pieces — pointy ears, glowing eyes, whiskers, round wheels, or shiny headlights.
  • Layer 4 (Whole Object): Combines those parts into a single confident decision — "Two pointy ears above glowing eyes and whiskers? That's 96% Cat!"

And notice the superpower built into every single rung of this ladder: because every layer uses sliding flashlights, the entire hierarchy is shift-proof. Move the cat or the car to the left or right, and the exact same edge detectors, part detectors, and object detectors still light up — just shifted over in the frame.

Playground 2 From Pixels to Meaning (The Visual Hierarchy)
Click any pipeline stage or drag the Depth Explorer
Depth Explorer (Zoom from Pixels to Meaning) Layer 1: Simple Edges
Current Zoom Level
Layer 1 — Simple Edges
What It Sees
Tiny slanted & curved edges
Shift-Proof Status
Still recognized! (Centered)
Core Visual Idea — Learn Once, Spot Everywhere

By reusing one tiny flashlight across the entire picture, a vision network needs thousands of times fewer dials than a plain pixel-memorizing network. Even better, engineers don't have to hand-craft those flashlights! Using backpropagation from Chapter 6, the network sculpts its own flashlights automatically — and remarkably, it naturally discovers edge finders in its first layer and complex part finders deeper down, echoing the way the human visual cortex works.

A New Way to Think About Seeing

Next time your phone unlocks by recognizing your face, or an AI spots a crosswalk in a rainy dashcam video, picture dozens of tiny glowing flashlights sweeping across the image in parallel. First come the edges. Then the corners and curves. Then eyes, noses, signs, and wheels — all snapping together into a vivid understanding of the scene, no matter where in the frame they happen to sit.

We now know how deep networks see space in pictures. In the next chapter, we'll make an even wilder leap: how AI turns words and ideas into locations on a giant map of meaning.

Intuition Check

Why does sliding a tiny pattern-flashlight across an image beat memorizing exact pixel positions?