Leveraging transfer learning with pretrained CNN models

So far, we have built our CNN deep learning models from scratch by specifying our own architecture. In this section, we will leverage a pretrained model that is basically an expert in the computer vision domain and renowned for image classification and categorization. We recommend you to check out Chapter 4Transfer Learning Fundamentals, for a brief refresher around pretrained models and their applications in this domain.

Pretrained models are used in the following two popular ways when building new models or reusing them:

  • Using a pretrained model as a feature extractor
  • Fine-tuning the pretrained model

We will cover both of them in detail in this section. The pretrained model we will be using in this chapter is the popular VGG-16 model, created by the Visual Geometry Group at the University of Oxford, which specializes in building very deep convolutional networks for large-scale visual recognition. You can find out more about it at http://www.robots.ox.ac.uk/~vgg/research/very_deep/. The ImageNet Large Scale Visual Recognition Challenge (ILSVRC) evaluates algorithms for object detection and image classification at large scale and their models have often secured the first place in this competition.

A pretrained model like the VGG-16 is an already trained model on a huge dataset (ImageNet) with a lot of diverse image categories. Considering this fact, the model should have learned a robust hierarchy of features, which are spatial, rotation, and translation invariant, as we have discussed before with regard to features learned by CNN models. Hence, the model, having learned a good representation of features for over a million images belonging to 1,000 different categories, can act as a good feature extractor for new images suitable for computer vision problems. These new images might never exist in the ImageNet dataset or might be of totally different categories, but the model should still be able to extract relevant features from these images, considering the principles of transfer learning that we discussed in Chapter 4, Transfer Learning Fundamentals.

This gives us an advantage of using pretrained models as effective feature extractors for new images, to solve diverse and complex computer vision tasks, such as solving our cat versus dog classifier with fewer images, or even building a dog breed classifier, a facial expression classifier, and much more! Let's briefly discuss the VGG-16 model architecture before unleashing the power of transfer learning on our problem.

..................Content has been hidden....................

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