chapter seven

7 Teaching Machines to See Better: Improving CNNs and Making Them Confess

 

This chapter covers,

  • Reducing overfitting of image classifiers by means of data augmentation, regularization, smart model training schemes
  • Principally choosing and implementing other model architectures (i.e. Minception inspired by Inception Resnet v2 model) that deliver better performance
  • Implementing a robust performant image classifier by using Keras pretrained models and transfer learning.
  • Interpreting the image classifiers knowledge by using modern machine learning interpretability techniques such as GradCAM

We have developed and trained a state-of-the-art image classifier on an object classification dataset. However, the results didn’t really live up to the reputation of the model. The model was heavily overfitting with ~30% validation and test accuracies and a whopping ~94% training accuracy. In this chapter we will discuss improving the model by reducing overfitting and improving validation and test accuracies. We will work our way to improve the model which will ultimately leave us with a model that reaches ~80% accuracy (equivalent to being able to accurately identify 160/200 classes of object) on validation and test sets. Furthermore, we will look at techniques that allow us to probe into the model’s brain to gain insights.

Figure 7.1: The entire workflow of an image classification problem

7.1     Techniques for reducing overfitting

7.1.1   Image data Augmentation with Keras

7.1.2   Dropout: Randomly switching off parts of your network to improve generalizability

7.1.3   Early stopping: Halting the training process if the network starts to under-perform

7.2     Towards minimalism: Minception net instead of Inception net

7.2.1   Implementing the stem

7.2.2   Implementing Inception Resnet A block

7.2.3   Implementing the Inception Resnet B block

7.2.4   Implementing the Reduction block

7.2.5   Putting everything together

7.2.6   Training Minception

7.3      If you can't beat them, join ‘em: Using pretrained networks to enhance performance

7.3.1   Transfer learning: Reusing existing knowledge in deep neural networks

7.4     GradCAM: Making CNNs confess

7.5      Summary

7.6      Answers to exercises: