Deep Learning · Step 3 of 8 · 9 min

CNNs for images

You know why convolutional networks suit images and how to reuse a pretrained one.

01 · The problem with plain layers

A small colour photo of 224 by 224 pixels is about 150,000 numbers. Connecting each of them to every neuron in a plain layer needs millions of weights, and the network has to learn separately that a cat in the top corner is the same as a cat in the middle.

02 · Convolutions: one small filter, slid everywhere

A convolutional layer learns small filters, often 3 by 3 pixels. Each filter slides across the whole image and responds wherever it finds its pattern, such as a vertical edge. The same few weights are reused at every position. That makes CNNs efficient and naturally good at finding a pattern wherever it appears.

Pooling layers or strided convolutions then shrink the image step by step. Each stage sees a wider area, so the network builds from edges to textures to parts to whole objects.

03 · Transfer learning is the normal way

You rarely train an image model from scratch. You take a network already trained on millions of images, such as a ResNet or EfficientNet, replace its last layer with one for your classes, and fine-tune it on your data. A few hundred labelled images per class can be enough.

Vision transformers, which split an image into patches and use attention, now match or beat CNNs on many tasks, especially with lots of data. CNNs remain common, fast and a good place to learn.

04 · Try it

05 · Check yourself

You have 400 labelled photos of three kinds of machine parts. What is the most sensible start?