Transfer Learning

Don't Train from Scratch

Transfer learning adapts a model pretrained on a large dataset to a new task. It is the standard approach for almost all applied computer vision — starting from ImageNet-pretrained weights dramatically reduces the data, compute, and time needed to achieve high performance.

Why It Works

Universal visual representations

Early and middle CNN layers learn universal visual primitives — edges, textures, shapes, gradients — that are useful for virtually any visual task. These transfer across domains because all visual data shares these low-level structures. Only the final task-specific layers need to be retrained.

Feature Extraction vs Fine-Tuning

Feature Extraction

Freeze all pretrained weights. Replace only the final classification head. Train only the new head on target data. Fast, few parameters, works with very small datasets (hundreds of images). Best when source and target are visually similar.

Fine-Tuning

Start from pretrained weights, replace the head, then train the whole model (or later layers) at a small learning rate on target data. Better performance especially when source and target domains differ. Requires more data and compute.

Common Strategy

1

Load pretrained weights — Start from ImageNet-pretrained ResNet, EfficientNet, ViT, or a foundation model like CLIP or DinoV2.

2

Replace the head — Swap the final classification layer for a new one with the number of target classes.

3

Freeze early layers — Keep early layers frozen initially (universal features, don't need updating).

4

Fine-tune later layers — Train later layers and the new head at a low learning rate on target data. Unfreeze more layers if performance plateaus or domain shift is large.

Need Help?

Ask the AI assistant about transfer learning, when to use feature extraction vs fine-tuning, or how to handle large domain shift.