Computer vision, made visual

CodeWithPurpose lessons that explain how a machine turns a photo into a label, a box, or a mask — through live demos and clear visuals. Click any topic to explore, no setup required.

Student exploring computer vision with CodeWithPurpose
Foundations

What Is Computer Vision?

A photograph looks obvious to you and is, to a computer, a wall of numbers with no idea what a face is. See the three different jobs hiding inside the phrase "computer vision", and why none of them were ever solved by writing rules.

10 min read

FoundationsInteractive

Images as Numbers

Zoom into any photo far enough and the picture disappears into a grid of numbers with nothing else hiding inside it. Click through a tiny image pixel by pixel and watch a face turn back into the grid it always was.

11 min read

Foundations

Colour and Channels

Colour is not one number per pixel, it is three, stacked on top of each other and constantly disagreeing. Split a photo into its red, green, and blue channels and find out which one was quietly doing almost all of the work.

10 min read

FoundationsInteractive

Convolution and Filters

One small grid of numbers, slid across every position in an image, is the operation underneath blur, sharpen, and every edge a neural network has ever found. Drag a 3×3 kernel across a photo and watch what each stop produces.

12 min read

PreprocessingInteractive

Edge Detection

An edge is not a line the camera drew, it is a place where brightness changes fast, and "fast" is a number you get to choose. Drag the threshold on a real photo and watch a coherent outline dissolve into noise, or vanish into nothing.

12 min read

Preprocessing

Corners and Keypoints

A corner survives a rotation, a crop, and a change of lighting in ways a raw pixel value never will, which is why decades of computer vision were built on finding them instead. See what makes one point in an image worth finding again in another.

11 min read

PreprocessingInteractive

Resizing, Normalising, Augmenting

A model trained on perfectly centred, evenly lit photos will fail the first time a real photo arrives sideways. Rotate, crop, and relight one training image and see how many new examples a single photo can honestly become.

11 min read

Classification

Image Classification

Naming what is in a photo sounds like the whole problem, and is actually the easy version of it: one label, for the entire image, and nothing about where. See why that constraint is a feature, not a shortcut.

11 min read

ClassificationInteractive

From Pixels to a Prediction

The simplest possible image classifier is a weight for every single pixel, added up into one score, and it is worse than it sounds. Drag the weights yourself and watch how little a model that ignores position can actually learn.

12 min read

ClassificationInteractive

Convolutional Neural Networks

Stack the sliding kernel from chapter four dozens of layers deep and something new happens: early layers learn edges, and later ones learn eyes, wheels, and faces, without anybody telling them to. Step through the layers of a small network and see what each one has learned to notice.

13 min read

Classification

Transfer Learning

Training a network like chapter ten's from nothing takes millions of photos you almost certainly do not have. Take one somebody else already trained on a different problem, keep everything but its last layer, and see how little new data it takes to repurpose it.

11 min read

Detection

Object Detection

Classification tells you a photo contains a dog. Detection tells you where, how many, and draws a box around each one — a genuinely harder problem, and the rest of this part exists to solve it.

11 min read

DetectionInteractive

Bounding Boxes and IoU

A predicted box that is "close" to the right one needs a number, not a shrug, and that number is Intersection over Union. Drag two boxes apart and watch a plausible-looking overlap score fall below 0.5.

12 min read

DetectionInteractive

Non-Max Suppression

A detector rarely proposes one box per object, it proposes a dozen, all clustered around the same dog. Raise and lower a suppression threshold and watch eleven overlapping boxes collapse into one, or refuse to.

11 min read

Detection

Image Segmentation

A box around a dog still includes fifteen pixels of fence behind it. Segmentation labels every pixel individually, and the moment two dogs overlap, decides whether it still knows they are different dogs.

12 min read

EvaluationInteractive

Confusion Matrix, One Class at a Time

One accuracy number across a hundred classes hides which ones the model actually confuses with each other. Open the full matrix and find the one pair of classes responsible for most of the errors.

12 min read

EvaluationInteractive

Mean Average Precision

Detection has no single "accuracy", because a prediction can be right about the class and wrong about the box, by varying amounts. Slide the confidence threshold across a set of detections and watch precision and recall trade against each other the way they did for a plain classifier.

13 min read

Evaluation

Dataset Bias

A model trained mostly on photos taken in daylight, indoors, of one demographic, has not learned to see — it has learned that dataset. See how a benchmark can keep rising while the system quietly gets worse for everyone the dataset under-represented.

11 min read

EvaluationInteractive

Overfitting and Augmentation

A network with millions of parameters can memorise ten thousand training photos outright, pixel quirks and all. Turn augmentation up and down and watch the gap between training and validation accuracy close, or refuse to.

12 min read

Applications

Face Detection and Privacy

The same pipeline that unlocks your phone can identify a stranger in a crowd from a single frame, and the two uses are not equally consented to. See where face detection ends and face recognition begins, and why that line is the whole ethical argument.

11 min read

Applications

Vision in Self-Driving Cars

A self-driving car cannot ask a model to be 99% sure before braking; it has to act inside a fraction of a second on whatever the camera and the other sensors currently agree on. See why no camera is ever trusted alone, and what happens when the sensors disagree.

12 min read

Practice

From Prototype to Production

A model that scores 94% in a notebook is not a product; a camera feed, a latency budget, and a phone that is three years old are. Age a vision model against a slowly drifting camera and a shrinking latency budget and see where a demo actually breaks.

12 min read

Open source

Your lesson goes here

Every lesson here was written by a student. Propose your own topic, or fix one that confused you. Drafts stay invisible until they are ready, so nothing you start can break the site.

Keep building your computer vision foundation

These lessons are part of CodeWithPurpose's free learning library — built by students, for students, everywhere.