Transfer Learning: Start with Useful Features
You have a small collection of labeled images, but training a large network from scratch would require far more data and computation.
Transfer Learning: Start with Useful Features explained visually
You have a small collection of labeled images, but training a large network from scratch would require far more data and computation. English captions are optional and start off. The complete transcript follows the written lesson.
What you will learn
You have a small collection of labeled images, but training a large network from scratch would require far more data and computation.
Reuse learned structure
You have a small collection of labeled images, but training a large network from scratch would require far more data and computation. Transfer learning offers another starting point. We begin with a model that has already learned useful representations from another dataset, then adapt it to the new task. The earlier training provides an initialization, not a guarantee that the model understands our images.
Replace the task-specific output
In a common image-classification workflow, a pretrained backbone extracts features and a new output head predicts the target classes. Initially, we may freeze the backbone and train only the new head. This reduces the number of parameters being updated and can provide a strong baseline. The input normalization, channel order, and image size must still match the model's expected preprocessing.
Check the source and target
The similarity between source and target data matters. A network trained on ordinary photographs may not transfer equally well to thermal images or specialized microscopy. Evaluate on held-out target examples and compare with simpler alternatives. Record the pretrained model's source, version, and permitted use. Transfer learning saves effort when the learned representations are useful; it does not remove the need for representative data or reliable evaluation.
Worked example
Suppose a backbone produces 512 features per image and a new linear head predicts three classes. That head contains 1,536 weights plus three biases, or 1,539 trainable parameters. Freezing the backbone lets us first test adaptation with a comparatively small trainable component.
Quick check: test your understanding
Try it yourself: Why should preprocessing be checked even when the pretrained weights load successfully?
Check the reasoning
The model may expect a particular channel order, scaling, normalization, or image shape. Loading weights does not verify those input conventions.
Does successful pretraining on one dataset prove accuracy on a different sensor?
No. The target sensor may create a substantial distribution change that requires adaptation and evaluation.
Further reading
Dive into Deep Learning — Aston Zhang, Zachary C. Lipton, Mu Li, and Alexander J. Smola.
Deep Learning — Ian Goodfellow, Yoshua Bengio, and Aaron Courville.
Original ToolsInVision teaching examples. Editorial approach · Suggest a correction
Accessible referenceLesson 71 transcript238 words · Video transcript · Matches the published narration and captionsOpen transcript
You have a few hundred labeled images and a model to build. Do you really need to teach a network everything from the beginning? Often, you can start with features that another model has already learned. That is the idea behind transfer learning.
Think back to our convolutional networks. Early layers can respond to edges and textures, while later layers combine those patterns. A pretrained network gives us an existing collection of these features. We then adapt that starting point to our own task.
For image classification, we can keep the feature extractor, also called the backbone, and replace its final prediction layer with a new head. If our task has three classes, the new head needs three outputs.
Here is a useful first experiment. Freeze the backbone and train only the new head. Frozen means its parameters are not being updated. It still processes every image and produces features.
Suppose it produces five hundred and twelve features. A linear head with three outputs has one thousand five hundred and thirty-six weights, plus three biases. That is a much smaller training problem than updating the entire network.
There is one catch. Features learned from everyday photographs may not work equally well on microscope images. Keep the expected preprocessing, test on unseen examples from your task, and compare with a simple baseline. Pretraining gives you a head start. Your own evaluation tells you whether that head start is useful.