The intuition behind transfer learning is that if this model trained on a large and general enough dataset, this model will effectively serve as a generic model of the visual world.
We can leverage these learned feature maps without having to train a large model on a large dataset by using these models as the basis of our own model specific to our task.
There are 2 scenarios of transfer learning using a pretrained model:
- Feature Extraction - use the representations of learned by a previous network to extract meaningful features from new samples.
We simply add a new classifier, which will be trained from scratch, on top of the pretrained model so that we can repurpose the feature maps learned previously for our dataset.
Do we use the entire pretrained model or just the convolutional base?
We use the feature extraction portion of these pretrained convnets (convolutional base) since they are likely to be generic features and learned concepts over a picture.
However, the classification part of the pretrained model is often specific to original classification task, and subsequently specific to the set of classes on which the model was trained.
- Fine-Tuning - unfreezing a few of the top layers of a frozen model base used for feature extraction, and jointly training both the newly added classifier layers as well as the last layers of the frozen model.
This allows us to “fine tune” the higher order feature representations in addition to our final classifier in order to make them more relevant for the specific task involved.