CNNs: how AI looks at images
A convolutional neural network (CNN) is a neural network built for images. Instead of looking at every pixel separately, it slides small filters across the picture to spot local patterns such as edges, corners and textures, then combines them into bigger shapes and finally whole objects.
Everyday analogy
Checking a long property document with a magnifying glass. You move the glass across the page bit by bit, noting stamps, signatures and dates, then put the clues together to decide whether the document is genuine.
Example
Reading a scanned claim form: a CNN finds where the stamp, the signature and the handwritten amount are, and checks the scan is clear enough before the text is read.
Why not use a normal neural network?
A 1000 × 1000 colour photo is 3 million numbers. Connecting every number to every neuron would need billions of weights, and the network would ignore which pixels sit next to each other. A CNN reuses the same small filter everywhere (weight sharing) and keeps neighbouring pixels together, so it needs far fewer weights and learns much faster.
The building blocks
| Part | What it does |
|---|---|
| Convolution | Slides a small filter (e.g. 3 × 3) over the image, multiplying and adding at each position |
| Filter (kernel) | A small grid of learned weights. Each filter learns one pattern: a vertical edge, a curve, a texture |
| Feature map | The result of one filter: a map of where its pattern appears. Many filters give many maps |
| Stride | How many pixels the filter jumps each time. A stride of 2 roughly halves the size |
| Padding | A border of zeros around the image, so the edges aren't lost and the size can stay the same |
| Pooling | Shrinks each map by keeping the biggest value (max pooling) or the average of each small patch |
| Fully connected layer | At the end, combines all the features found to decide the answer |
Image patch Filter (finds vertical edges)
10 10 0 1 0 -1
10 10 0 1 0 -1
10 10 0 1 0 -1
Each row: 10×1 + 10×0 + 0×(−1) = 10
Three rows: 10 + 10 + 10 = 30 → a strong edge here
Max pooling on a 2×2 patch: [1 3]
[2 5] → keep 5What CNNs are used for
| Job | What it gives you | Example |
|---|---|---|
| Image classification | One label for the whole image | "This X-ray shows pneumonia" or "no pneumonia" |
| Object detection | A box and label around every object | Finding cars and pedestrians (e.g. YOLO, Faster R-CNN) |
| Segmentation | A label for every pixel | Outlining a tumour; separating road from pavement |
| Feature extraction | A list of numbers that describes the image | Image search: "find photos like this one" |
Famous CNNs that moved the field forward
| Model | Year | What it showed |
|---|---|---|
| LeNet-5 | 1998 | CNNs can read handwritten digits, e.g. on bank cheques |
| AlexNet | 2012 | Deep CNNs trained on GPUs, with ReLU and dropout, beat older methods by a wide margin |
| VGG | 2014 | Going deeper with many small 3 × 3 filters works well |
| ResNet | 2015 | Skip connections let networks with 100+ layers train without the signal fading |
Transfer learning: don't start from zero
Training a CNN from scratch needs millions of labelled images. Transfer learning takes a model already trained on a huge collection (such as ImageNet, with over a million photos in 1,000 categories) and reuses what it learned about edges, shapes and textures.
| Approach | How | Best when |
|---|---|---|
| Feature extraction | Freeze the pretrained layers and train only a new final layer | You have little data and a similar task |
| Fine-tuning | Also retrain some top layers, gently, with a low learning rate | You have more data or images that look different |
Example: with only about 2,000 labelled photos of damaged and undamaged cars, a pretrained CNN can be adapted to sort motor-claim photos, something that would need far more data from scratch. See also Fine-tuning. Newer vision transformers now compete with CNNs, but CNNs remain fast and widely used, especially on phones and cameras.
Try it yourself
About 10 minLook inside a real CNN
- Open CNN Explainer (free, runs in your browser).
- Pick an example image and click on the layers one by one.
- Click a single neuron to see the filter sliding over the image.
What you should see: Early layers light up on edges and colours; later layers respond to bigger parts, until the last layer gives a probability for each class.
Use any free AI chatbot (ChatGPT, Claude, Gemini or Copilot) where needed. Never paste private or confidential information.