- Introduced by
- Pan, S. J. & Yang, Q. (transfer learning framework); Krizhevsky, Sutskever & Hinton (deep CNN backbone)
- Year
- 2010–2012
- Type
- Transfer learning / supervised classification
- Family
- Deep learning / NLP / CV
What does it do?
Transfer learning for image classification takes a deep neural network backbone, typically a CNN or a Vision Transformer, that was pretrained on a large dataset such as ImageNet, and adapts it to label images from a new target domain.
The approach reuses visual features learned on the source task, so a usable classifier can often be built from far fewer labeled target images than training from scratch would need. How well it works depends on how similar the source and target images are and on which layers are updated.
The intuition behind the method
A network trained to recognise a large set of everyday object categories on ImageNet develops low-level detectors such as edges and textures, and combines them into higher-level shapes. Many of these features remain useful when the target classes are different objects, so the network does not need to learn them again from zero. The usual options are to freeze the pretrained feature extractor and retrain only a new output layer, or to fine-tune some or all pretrained weights at a small learning rate. Which option suits a task depends mainly on how far the target images are from the source domain and on how many labeled examples are available.
History
Pan and Yang's survey categorised and reviewed transfer learning methods for classification, regression, and clustering, and clarified how transfer learning relates to domain adaptation, multitask learning, and covariate shift. The practical turning point for image classification came with Krizhevsky, Sutskever, and Hinton's AlexNet, which showed that a deep CNN trained on ImageNet could serve as the basis for a high-performing classifier. Later backbones, including VGG, GoogLeNet, ResNet, and EfficientNet, improved the pretrained features, and Vision Transformers extended the approach to attention-based architectures.
When to use it
Choose transfer learning when the labeled target dataset is small, when compute or time does not allow training a deep network from scratch, and when the target images resemble the pretrained source data, such as natural photographs, medical scans, or satellite imagery. Three assumptions should be checked before applying it. First, source and target images should share related visual structure, because low-level features only carry over when the domains are related. Second, the target label set does not have to match the source classes, but the target labels should be reliable, since label noise distorts both the new head and any fine-tuned layers. Third, the test split must remain independent of training and model selection. The fewer the labeled images, the more important it is to freeze most backbone layers and to apply data augmentation. Do not use a pretrained backbone as a fixed feature extractor without any adaptation when the target classes differ strongly from the source classes, since the learned features may not match the task. If target images are very unlike the pretrained domain, such as abstract scientific diagrams compared with photographic ImageNet scenes, continuing pretraining on unlabeled domain images before fine-tuning is advisable. When a large labeled dataset is available and the domain is far from the source, a from-scratch baseline should be compared before committing to transfer.
Limitations and considerations
- Negative transfer can occur when source and target domains are highly dissimilar: the pretrained features then hurt, and the model can perform worse than a randomly initialised baseline.
- The practitioner must choose the backbone, the number of frozen layers, and the learning rates, and no single setting is the right default across domains.
- Pretrained weights reflect the composition of the source dataset, so biases in that data, such as over-represented object types or imaging conditions, can carry over into the target model.
- Large backbones such as ViT-L need substantial GPU memory and can have higher inference latency than smaller networks.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Needs fewer labeled target images than training the same architecture from scratch, because the frozen or lightly updated early layers already encode general visual features.
- Starting from pretrained weights gives the optimiser a point that is usually closer to a good solution than random initialisation, which often shortens training.
- Low-level features such as edges and textures carry over across many natural-image domains, so one backbone can be reused for different target tasks.
- The strategy works with most modern backbone families, including CNNs and Vision Transformers, so the architecture can be chosen to fit the compute budget.
- Freezing layers and data augmentation both limit overfitting of the new head on small datasets, and the two can be combined.
Applications
- Medical image classification: pathology slide analysis, radiology report triage, skin lesion grading.
- Remote sensing and satellite imagery: land-use classification, crop-type mapping.
- Industrial quality control: defect detection and product categorisation from camera images.
- Fine-grained recognition: bird species, plant disease, vehicle make and model identification.
- Document image classification: handwritten digit recognition, form type sorting.
- Biodiversity monitoring: wildlife camera trap species identification with limited annotated images.
How it works
How it works
Pick a pretrained architecture such as ResNet, EfficientNet, VGG, or a Vision Transformer. The choice depends on how close the target images are to the source data, the available GPU memory, and the required inference speed. A backbone pretrained on imagery closer to the target, such as medical images for a radiology task, usually transfers better than a generic ImageNet model when such weights exist for the architecture you need.
Freeze the early and middle layers so that generic low-level features such as edges and textures are kept, and leave the later layers trainable. Freezing more layers reduces the number of parameters that can overfit on a small dataset; unfreezing more layers allows deeper adaptation when there is enough labeled data to support it.
Remove the original classification layer and attach a new fully connected layer, or a small multilayer perceptron, whose output size equals the number of target classes. The new layer starts from random weights, so it holds no knowledge of the target task until it has been trained.
Train the new head and any unfrozen backbone layers on the labeled target data with a cross-entropy loss. In the formula, y_c is the one-hot label indicator for class c and p̂_c is the model's predicted probability for that class, so the loss for one image is the negative log-probability assigned to its true class, summed over the C classes. A small learning rate keeps the pretrained weights changing gradually; learning-rate warm-up, different learning rates for different layer groups, and data augmentation are common practice.
Formula
\mathcal{L} = -\sum_{c=1}^{C} y_c \log \hat{p}_cMeasure performance on a held-out test set that was not used for training or model selection. Overall accuracy alone can hide poor results on minority classes, so report per-class precision and recall alongside macro-averaged F1. For imbalanced classes, precision-recall curves or average precision are more informative than ROC AUC, which can look high even when the rare class is poorly detected. Saliency maps such as Grad-CAM give a heuristic view of the image regions associated with a prediction. They are not proof of the model's reasoning and should be read alongside error analysis and held-out checks for background shortcuts.
Common pitfalls
- Freezing the whole backbone and training only the head when the target domain differs substantially from ImageNet, which can leave the features poorly matched to the task.
- Using the same high learning rate for pretrained layers as for the new head, which can overwrite the learned representations early in training.
- Skipping data augmentation on a small target dataset, which makes severe overfitting of the classification head likely.
- Reporting only overall accuracy on imbalanced data, which can hide poor performance on rare classes.
- Omitting validation during fine-tuning and early stopping, so the full network can overfit without the problem being noticed.
Frequently asked questions
How many labeled images do I need for transfer learning to work?
There is no fixed minimum. Transfer learning can be effective with anywhere from dozens to hundreds of images per class, provided the source and target domains share visual structure. When each class has only a handful of examples, freeze most of the backbone and apply strong data augmentation, since the new head then has very little signal to learn from.
Should I fine-tune the whole network or just the head?
For very small datasets or highly similar domains, training only the head is safer and faster. For larger target datasets or greater domain shift, progressively unfreezing and fine-tuning deeper backbone layers with a small learning rate typically improves accuracy.
Which pretrained backbone should I choose?
ResNet-50 and EfficientNet-B0 to B4 are common general-purpose starting points and a sensible first choice when the target images resemble natural photographs. For medical or remote-sensing imagery, look for pretrained weights trained on imagery from that domain, if they exist for the architecture you need, and compare them with a general ImageNet model.
What is negative transfer and when does it happen?
Negative transfer occurs when the pretrained features from the source domain actively harm performance on the target task because the two domains are too dissimilar. Symptoms include fine-tuned performance below a randomly initialised baseline. The remedy is either to use a domain-closer pretrained model or to extend pretraining on unlabeled target images before fine-tuning.
How do I justify transfer learning in a research paper?
Report the backbone name, source dataset, and pretraining protocol. Specify which layers were frozen and which were fine-tuned, the learning rate schedule, augmentation strategy, and validation procedure. Compare against a from-scratch baseline to quantify the benefit and disclose any known biases in the source dataset.
Related methods
Sources
Pan, S. J., & Yang, Q. (2010). A survey on transfer learning. IEEE Transactions on Knowledge and Data Engineering, 22(10), 1345–1359.
Open DOI referenceKrizhevsky, A., Sutskever, I., & Hinton, G. E. (2012). ImageNet classification with deep convolutional neural networks. Advances in Neural Information Processing Systems, 25.
Open publication reference