Back to Study Material Deep Learning

Transfer learning

Transfer learning is the practice of taking a neural network that was trained on a large dataset for one task and repurposing it for a different but relate...

Transfer learning

Leveraging Pretrained Models via Transfer Learning

Transfer learning is the practice of taking a neural network that was trained on a large dataset for one task and repurposing it for a different but related task. Rather than training a model from random weights, which requires enormous data and compute, transfer learning starts from a strong pretrained initialisation that already understands low-level and mid-level features of the domain.

The intuition is that features learned by a model trained on a large image dataset like ImageNet, such as edges, textures, and object parts, are broadly useful for many vision tasks. A model trained on millions of diverse images has developed powerful general visual representations that can be adapted to a specific domain with far less data.

The standard approach is to take a pretrained model, remove or replace the final classification layer with a new one matching the target task's number of classes, and train this new head on the target dataset. If the target dataset is small, only the new head is trained and the pretrained weights are kept frozen. If more data is available, all weights are fine-tuned with a small learning rate.

Transfer learning dramatically reduces the amount of labelled data and training time needed. A model fine-tuned on a few hundred medical images often outperforms a model trained from scratch on tens of thousands.

A concrete example: a chest X-ray disease classification system uses a ResNet-50 pretrained on ImageNet. Only the final layer is replaced with a two-class output for pneumonia detection. Fine-tuning on 5,000 labelled X-rays achieves 92 percent accuracy, far better than training from scratch on the same data.

Exam tip: interviewers often ask when transfer learning does not help. If the source and target domains are very dissimilar (for example, natural images and satellite radar data), early layers may need significant retraining or transfer may provide little benefit. Understanding domain similarity is key to deciding how much of the network to freeze versus fine-tune.