Back to Learning Area

Computer Vision (CNNs): How Machines Learned to See

How machines learned to read images and could suddenly tell dogs from cats — most of the time.

  • Architectures
  • 12 min
  • Expert

Plain Language

This preview is in Plain Language. The whole portal is also available in Plain Language. You can change the language at the top. Or use the button below. Our Plain Language texts are AI-assisted and editorially reviewed. They follow the core principles of easy-to-read language, but they are not certified Easy Read: a review panel of people with learning difficulties does not test them.

Preview: How machines recognize images

What are CNNs?

This article explains CNNs. CNN means: Convolutional Neural Network. This is a network for image recognition. CNNs recognize patterns in photos. This helps an AI find faces or cars.

How filters find patterns

A CNN uses many small filters. Filters are small image patterns. Each filter slides over the photo. It looks for its pattern everywhere. This is how the network recognizes edges and textures.

From simple to complex

A CNN has many layers. The first layer recognizes simple edges. The next layer recognizes shapes. Deeper layers recognize faces or cars. This is how the AI learns step by step.

In 2011, the best image recognition system scored 74 percent on ImageNet — respectable across a thousand categories, but far from human level. Four years later, a machine hit 96 percent, outperforming humans. The leap came from a fundamentally different way of looking at images — powered by large datasets and graphics cards.

This article breaks down the three core mechanisms that make Convolutional Neural Networks so powerful: how filters scan for patterns (convolution), how spatial compression creates robustness (pooling), and how stacking these operations builds a hierarchy from edges to faces.

The Spatial Principle

Images have spatial structure. A fully connected network treats every pixel as independent — it has no concept of neighboring. Convolution exploits locality and repetition: the same small filter detects the same pattern everywhere, with dramatically fewer parameters. This single design choice unlocked the entire field of deep computer vision.

Convolution: The Scanning Filter

Definition

Convolution, Kernel & Feature Map

Analogy

Imagine searching a large photograph for a specific texture — say, a brick pattern. Instead of memorizing the entire photograph pixel by pixel, you cut out a small template of the brick texture (3×3 patch) and slide it across the photo. At each position, you check: Does this patch match my template? Where it matches, you mark the spot. You are using ONE template everywhere — that is parameter sharing. And because you slide it across the entire image, you find bricks no matter where they appear — that is translation equivariance (the result only becomes shift-invariant through pooling).

Example

The analogy suggests that filters are predefined. In reality, the CNN learns its filter values through backpropagation — it discovers on its own which patterns are useful.

Worked Example: Edge Detection

Consider this vertical edge detection filter. At each position, it computes the dot product with the image patch beneath it:

[[-1, 0, 1],
 [-1, 0, 1],
 [-1, 0, 1]]

On a uniform area (e.g., blue sky), the negative and positive values cancel out — result: 0 (no edge). At a sharp transition (dark left, bright right), the positive values on the right side produce a strong signal while the negative values subtract the dark pixels — result: high value, indicating a vertical edge.

The efficiency gain from parameter sharing is enormous. A fully connected layer mapping a 28×28 grayscale image to 128 neurons requires over 100,000 parameters. A convolutional layer with 32 small 3×3 filters manages with just 288 parameters — for the same input image (in both cases counting only the weights, without biases).

Fully Connected Layer
28 x 28 x 128 = 100352

Over 100,000 parameters — every pixel connected separately, no spatial awareness

Convolutional Layer
32 x 3 x 3 x 1 = 288

Only 288 parameters — shared filters, local patterns, translation equivariance

Caution

Misconception: Filters Are Hand-Designed

Early computer vision (before 2012) did use hand-crafted filters like the Sobel operator. CNNs learn their filter values through backpropagation. The edge detection filter above is a pedagogical example showing WHAT a filter does — in practice, the network discovers its own optimal filters during training.

Interactive: Convolution Step by Step

Watch how the edge detection kernel (3×3) slides across the 5×5 input image. At each position, the dot product is computed — the result fills the feature map.

1
2
0
3
1
0
1
3
2
0
2
0
1
0
3
1
3
2
1
0
0
2
1
3
2
-1
0
1
-1
0
1
-1
0
1
Step 1 / 10The input image and kernel are ready. Click Next to slide the kernel across the image step by step.
Controls
Steps

Try it: find the edges

A single 3x3 filter, slid across an image, acts like an edge detector. Pick a filter and a shape – and watch which edges it highlights.

Pooling: Controlled Compression

Definition

Pooling, Max Pooling & Stride

Analogy

Imagine you are proofreading a long report and creating a summary. For each paragraph (2×2 window), you extract only the single most important fact (max value) and discard the rest. Your summary is 75 percent shorter, but it preserves the key findings. You lose the exact word position, but you keep the knowledge that the finding EXISTS in that section.

Example

The analogy applies to Max Pooling. Average Pooling would be more like averaging all statements in a paragraph — less selective, but sometimes useful.

Worked Example: Max Pooling

A 4×4 feature map with values [[8, 2, 5, 1], [3, 7, 4, 6], [9, 0, 3, 2], [1, 4, 8, 5]] is partitioned into four non-overlapping 2×2 blocks with stride 2. From each block, only the largest value survives: Top-left block [8, 2, 3, 7] → 8. Top-right block [5, 1, 4, 6] → 6. Bottom-left block [9, 0, 1, 4] → 9. Bottom-right block [3, 2, 8, 5] → 8. Result: [[8, 6], [9, 8]].

[8, 2, 5, 1]    Max Pooling     [8, 6]
[3, 7, 4, 6]  ────────────→  [9, 8]
[9, 0, 3, 2]    2x2, stride 2
[1, 4, 8, 5]

Spatial resolution dropped by 75 percent (from 16 to 4 values), but the strongest activations — the clearest evidence of detected patterns — survive intact.

Caution

Nuance: Pooling Is Not Always Ideal

Pooling deliberately sacrifices spatial precision. For tasks requiring pixel-precise output (e.g., medical image segmentation), modern architectures sometimes replace pooling with strided convolutions — convolutions with a stride greater than 1 that reduce dimensions while retaining learnable parameters.

The Feature Hierarchy: From Edges to Faces

By stacking multiple Conv→ReLU→Pool blocks, a CNN builds a hierarchical representation of the input image. Early layers learn simple, local patterns. Deeper layers combine these into increasingly complex structures. This hierarchy emerges automatically through training — it is not programmed by humans.

Feature Hierarchy in a CNN

Layers 1–2: Edges & Gradients Simple local patterns: horizontal lines, vertical edges, color gradients
Layers 3–4: Textures & Shapes Combinations of edges: grid patterns, arcs, corners
Layers 5–6: Object Parts Recognizable structures: eyes, wheels, windows, snouts
Deep Layers: Whole Objects Complete concepts: faces, cars, dogs, houses

Like building with LEGO bricks: Level 1 is individual bricks (edges). Level 2 combines bricks into recognizable sub-structures — a wheel assembly, a window frame. Level 3 snaps sub-structures together into a complete house or car. Each level works with larger, more meaningful building blocks assembled from the level below. No one told the network which sub-structures to build — it figured out which combinations are useful on its own.

The CNN Pipeline

  1. 1. Input Image
  2. 2. Conv Layer
  3. 3. ReLU
  4. 4. Pooling
  5. 5. Flatten
  6. 6. Dense → Output

At the end of the pipeline comes the flatten step: the stacked 2D feature maps are converted into a single 1D vector. This vector is fed into classical dense layers (also called fully connected layers), which perform the final classification based on the extracted features.

ImageNet Milestones (Top-5 Accuracy)

2011 — Handcrafted Features

74 %

2012 — AlexNet

85 %

2015 — ResNet

96 %

Human Baseline

~95 %

Interactive: What early and deep layers see

The first picture is the input: a car made of 28 × 28 grayscale pixels. Next to it are feature maps — the brighter a cell, the more strongly the filter responded there. Move the slider from the early to the deep layer. Step 1 is computed for real: with the edge filter from the worked example and the same matrix rotated by 90 degrees. From step 2 on, the picture is simplified: a trained CNN learns its filters itself, and its deep feature maps look far less tidy. Also watch the map size: as with pooling, it shrinks from step to step.

LeNet (paper 1998, in use since the mid-1990s): Yann LeCun used convolution and pooling to read handwritten digits on bank checks (predecessors had already read postal codes) — the first practically deployed CNN.

AlexNet (2012): Won the ImageNet competition by a large margin through the use of ReLU activations and massively parallel GPU training. This moment marked the breakthrough of deep learning in mainstream AI research.

VGG (2014): Demonstrated that consistently small 3×3 filters in very deep networks yield better results than large filters. Depth as a design principle.

ResNet (2015): Enabled networks with 152 layers through residual connections — shortcuts that allow the input of a layer to skip directly past several layers. Since 2020, Vision Transformers have been giving CNNs real competition; many of today's image models are transformers or hybrids, but convolutions and residual connections still live on in many of them.

Why do skip connections work? Without them, very deep networks are harder to optimize: adding layers even worsens training accuracy (the degradation problem), although normalization had already largely defused the vanishing gradient problem. Skip connections allow the gradient to bypass layers and flow back unimpeded. Additionally, each layer can learn the identity function — if a layer contributes nothing useful, it simply passes the input through unchanged.

  • Audio spectrograms: Speech is represented as a 2D image (time × frequency) and analyzed with CNNs — same architecture, different data.
  • Time series data: Industrial sensor data for anomaly detection — 1D convolutions scan for temporal patterns.
  • Game boards: AlphaGo encoded the Go board state as a 19×19 image with multiple channels and used CNNs for position evaluation.

The core rule: any data with fixed spatial or temporal topology benefits from convolution.

Caution

Common Misconceptions

CNNs Understand Images

CNNs detect statistical pixel patterns, not semantic understanding. Adversarial examples prove this dramatically: minimal pixel changes invisible to the human eye can make a CNN classify a panda as a gibbon with 99 percent confidence. The network never learned what a panda IS — only which pixel patterns typically correlate with that label.

More Filters = Better Results

Blindly inflating a network with hundreds of filters dramatically increases the overfitting risk: the network memorizes image noise instead of generalizable patterns. Training time and GPU memory requirements also explode. The art lies in choosing the right number of filters for the complexity of the task.

Note

Key Takeaways

  • Convolution replaces full connectivity with local, shared filters — making spatial pattern detection both efficient and position-independent (translation equivariance).
  • Pooling compresses feature maps spatially, trading exact position for robustness and computational savings.
  • Depth creates abstraction: early layers detect edges, middle layers detect textures and parts, deep layers recognize whole objects — mirroring biological vision.

Check

Knowledge Check: CNNs

Not completed

What does a convolution filter (kernel) do when it slides over an image?

Select one answer

Answer Key: 1) B · 2) A · 3) C · 4) C · 5) B · 6) C

Check

Comprehension Check

Can you explain this in your own words? Tick what you've got.

0 of 3 done