tezvyn:

Transfer Learning: Don't Train Vision Models from Scratch

AI-drafted, machine-checkedSource: Wikipedia: Transfer learningadvanced
Transfer Learning: Don't Train Vision Models from Scratch

Don't train a vision model from scratch. Transfer learning reuses a model trained on a huge dataset (like ImageNet) as a starting point for your specific task. This lets you achieve high accuracy on new image types with much less data and compute.

WHY IT EXISTS: Training large-scale computer vision models from scratch is incredibly expensive, requiring millions of labeled images and weeks of GPU time. Most practical applications lack this scale of data and resources. Transfer learning provides a shortcut to high performance.

THE MENTAL MODEL: Think of it like a chef who has mastered French cuisine. To learn Italian cooking, they don't start from zero. They transfer their knowledge of knife skills, heat management, and flavor pairings. Similarly, a vision model pre-trained on a vast dataset has already learned to see fundamental features like edges, textures, and shapes. Transfer learning reuses this foundational knowledge for a new, specific task.

HOW IT WORKS: A deep neural network learns in layers. Early layers detect simple features (lines, colors), while later layers recognize complex patterns (faces, wheels). In transfer learning, you take a pre-trained model and "freeze" the weights of these early, general-purpose layers. You then replace the model's original final layer with a new one designed for your specific classes (e.g., 'truck' vs 'not-truck'). Finally, you train only this new layer and perhaps a few of the later layers on your smaller, specific dataset. This process, called fine-tuning, is dramatically faster and requires far less data than training from scratch.

WHEN TO USE IT: Use transfer learning when your target dataset is relatively small, but is conceptually similar to a domain where a large pre-trained model exists. It is the default, standard approach for most image classification, object detection, and segmentation tasks, such as classifying medical images or identifying specific product defects on an assembly line.

WHEN NOT TO USE IT: If your image data is fundamentally different from the pre-trained model's data (e.g., using a model trained on photos of objects to classify audio spectrograms), the learned features won't transfer well. Also, if you happen to have a dataset as large or larger than the original pre-training set, training from scratch may yield a superior, more specialized model.

ONE CANONICAL EXAMPLE: A model like ResNet, pre-trained on the 1.4 million images in the ImageNet dataset, can recognize 1,000 general object classes. To build a classifier for specific dog breeds, you would start with this pre-trained ResNet. You would replace its final layer and fine-tune the model on your smaller dataset of dog breed images. The model already knows what fur, eyes, and ears are; you just teach it the specific combinations that define a Beagle versus a Poodle.

Read the original → en.wikipedia.org

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.