Summary

In this chapter, we illustrated the use of pretrained deep neural networks for developing image classification models. Such pretrained networks, which are trained using over 1 million images, capture reusable features that can be applied to similar but new data. This aspect becomes valuable when developing image classification models with relatively smaller datasets. In addition, they provide savings in terms of the use of computational resources and time. We started by making use of the RESNET50 pretrained network to identify an image of a Norwich terrier dog. Subsequently, we made use of 2,000 images from the CIFAR10 dataset to illustrate the usefulness of applying pretrained networks to a relatively smaller dataset. The initial convolutional neural networks model that we built from scratch suffered from overfitting and did not yield useful results.

Next, we used the pretrained RESNET50 network and customized it to suit our needs by adding two dense layers on top of the pretrained network. We obtained decent results, with a test data accuracy of about 76.8%. Although pretrained models can provide faster results that require fewer epochs, we need to explore improvements that we can make to the model's performance with the help of some experimentation. In an effort to explore better results, we experimented with the adam optimizer, which yielded test data accuracy of about 77.2%. We also carried out hyperparameter tuning, which yielded the best levels in terms of the number of units in the dense layer, which was 512, the dropout rate in the dropout layer, which was 0.1, and the batch size at the time of fitting the model, which was 30. The image classification accuracy with this combination yielded a test data accuracy of about 79.8%. Finally, we experimented with the pretrained VGG16 network, where we obtained test data accuracy of about 75.6%. These experiments illustrated how we can explore and improve model performance.

In the next chapter, we will explore another interesting and popular class of deep networks, called generative adversarial networks (GANs). We will make use of GANs to create new images.

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

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