Transfer Learning

Transfer learning does exactly as the name says. The idea is to transfer something learned from one task and apply it to another. Why? Practically speaking, training entire models from scratch every time is inefficient, and its success depends on many factors. Another important reason is that for certain applications, the datasets that are publicly available are not big enough to train a deep architecture like AlexNet or ResNet without over-fitting, which means failing to generalize. Example applications could be online learning from a few examples given by the user or fine-grained classification, where the variation between the classes is minimal.

A very interesting observation is that final layers can be used to work on different tasks, given that you freeze all the rest, whether it be detection or classification, end up having weights that look very similar.

This leads to the idea of transfer learning. This means a deep architecture that is trained on a significantly large amount of data (for example, ImageNet) can generalize so well that its convolutional weights can act as feature extractors, similar to conventional visual representations and can be used to train a linear classifier for various tasks.

This chapter aims to teach the reader how to take readily available trained models, change their structure, and retrain certain layers for specific tasks in TensorFlow. We will see how transfer learning will help improve results and speed up training time.

The main topics covered in this chapter are as follows:

  • Pre-initializing a model with weights from another trained model
  • Using TensorFlow to load the models and freeze/unfreeze layers when needed
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.129.217.5