All courses Machine learning

Computer Vision with PyTorch: Classify Real Photos

Intermediate

Transfer learning from a small pretrained model, trained and tested on a laptop CPU.

Intermediate 9 lessons 29 lab exercises Certificate Updated

You build

A command-line program that tells which of five kinds of flower is in a photo, built by adapting a small pretrained network from torchvision (MobileNetV3-Small) to a few thousand real photos on a laptop CPU.

You need

  • Writing Python with functions and imports, and running a script from a terminal
  • PyTorch basics: tensors with their shape and data type, a network built from layers, and a training loop with batches, a loss, an optimizer and epochs. The course Deep Learning with PyTorch teaches all of this.
  • How a classifier is trained and judged: class scores turned into probabilities, cross-entropy loss, accuracy on a validation and a test set, and what overfitting is

To build it on your own machine

This is optional and comes with a plan. The course pack brings the starting files, a ready container and a check for every lesson. You need only Docker and git, plus your own AI coding agent if you want a tutor.

What you learn

You do not train a vision model from zero. You borrow one and teach it your classes.

You build one program that says which of five flowers is in a photo. It starts from a small network already trained on a million images, and you adapt it to your own classes with a few thousand real photos, in minutes, on a laptop CPU. You see what an image is to a model, what a convolutional network looks for, how to load and augment photos, train a new final layer, fine-tune the rest, measure the result honestly and read its mistakes. One task, image classification, done properly.

  • Images as Tensors. A photo is a grid of numbers in three colour channels. Decoding, resizing, cropping, scaling and normalising turn any photo file into the tensor a model expects.
  • What a Pretrained Network Knows. Convolution layers turn pixels into edges, textures and parts, and finally into one feature vector. A network trained on a large image collection has already learned features that fit many other photos.
  • Transfer Learning. Freeze the pretrained layers, replace the final layer, train it on your own classes, then fine-tune with a small learning rate and augmented photos.
  • Honest Measurement. A fixed split, a test set used once, a confusion matrix, precision and recall per class, and a look at the photos the model gets wrong.

Lessons

Where it fits

Course 5 of 5 on the Machine Learning Engineer path.

How our courses are made Report a mistake