0%
Transfer Learning

Transfer Learning

Reuse a pretrained network instead of starting from scratch: linear probing, fine-tuning, freezing BatchNorm correctly, and choosing an approach based on your data.

10-15 min

Transfer Learning

You have eight hundred labeled photos and a classification problem to solve. Chapter 2 established what happens if you train a deep network from scratch: it will memorize your eight hundred images and fail to generalize. Chapter 3 showed that serious vision architectures have tens of millions of parameters. Eight hundred examples for ten million parameters is a lost cause, and no amount of regularization will reverse that ratio.

There is a way out, though, and it is standard practice in the field, not an amateur shortcut. Someone has already trained a network on a million images, paid for thousands of hours of compute, and published the weights. That network has learned to detect edges, textures, repeating patterns, and composite shapes. None of this is specific to the classes it was meant to recognize: these are the basic building blocks of every natural image. Your eight hundred photos are made of them too.

Transfer learning consists of taking those building blocks and learning only the last step: the combination that answers your question. The number of parameters to estimate drops from ten million to a few thousand, and suddenly eight hundred examples are enough. The gain is of the same order as the one convolution brings over the dense layer: you haven't found a better algorithm, you've avoided relearning what was already known.

Link copied!