MLCrack

    COMPUTER VISION · INTERVIEW QUESTION

    Explain the concept of transfer learning in computer vision.

    🟢 beginner · Image Classification

    Hint: Using a model pre-trained on ImageNet for your specific task.

    Answer

    Transfer learning uses knowledge from a model trained on a large dataset (e.g., ImageNet with 1.4M images) and applies it to a different but related task.

    Interview reasoning

    Process:

    1. Take a pre-trained model (ResNet, EfficientNet, ViT).

    2. Replace the final classification layer with one matching your number of classes.

    3. Fine-tune: either freeze early layers (feature extraction) or update all layers (full fine-tuning).

    Why it works: early CNN layers learn universal features (edges, textures, shapes) transferable across tasks. Later layers learn task-specific features.

    Benefits: requires much less data (hundreds vs millions of images), faster training, better performance.

    Modern trend: foundation models (CLIP, DINOv2) provide even more powerful pre-trained features. CLIP enables zero-shot classification by matching images to text descriptions.

    Transfer learning starts from representations trained on a related distribution. Freeze or partially fine-tune when labels are scarce, and allow broader adaptation when domain cues differ. Compare head-only, partial and full fine-tuning with layer-appropriate learning rates, keeping acquisition-specific holdouts and training/evaluation state explicit.

    Worked example. A pretrained image backbone can train a new classifier on a small label set, then unfreeze later blocks if validation supports it.

    Validation

    Compare against a strong from-scratch or simple baseline under matched budgets; assess domain, rare-class and sample-size slices across seeds.

    Common pitfalls

    Transfer can be negative. Frozen weights do not automatically freeze normalization running state, and pretraining/evaluation overlap can inflate results.