Deep Learning · TEE · section

Model answer: feature extraction and fine-tuning

CNN architectures and transfer learning

Question

Question. Explain transfer learning for image classification with limited labeled data. Distinguish feature extraction from fine-tuning and describe the training procedure.

Answer — step by step

Transfer learning reuses knowledge represented by a model trained on a source task to support a related target task. A pretrained CNN can provide useful visual representations, reducing the target data and training effort needed compared with learning all features from random initialization.

Freezing and fine-tuning differ in whether selected pretrained weights are allowed to update. Tap the diagram to enlarge.

Procedure

1. Define the target classes and create separate training, validation and test splits. Prevent duplicate or closely related captures from leaking across splits.

2. Choose a suitable pretrained backbone and apply its required input size and preprocessing.

3. Replace the original classifier with a new head whose output count matches the target classes.

4. Freeze the backbone and train the new head. Only the unfrozen parameters receive optimizer updates.

5. If validation results justify it, unfreeze selected later backbone layers and continue training with a suitably smaller learning rate.

6. Select hyperparameters and checkpoints using validation data. Evaluate the selected model on the held-out test set.

Feature extractionFine-tuning
Pretrained backbone weights remain fixedSome or all selected pretrained weights are updated
New classifier learns from fixed representationsRepresentations can adapt to the target task
Usually fewer trainable parametersUsually more trainable parameters and greater risk of overfitting on a small dataset

The benefit depends on how useful the source features are for the target data. Transfer is not guaranteed to help every unrelated task. For a numerical, count all stored parameters separately from the trainable subset; freezing a layer does not delete its weights.