Binary classification using pretrained deep neural networks (VGG16)

Project description:

Input: 4000 labeled images as cat and dog. The set is divided into training, validation and test sets of 1000, 500 and 500 examples of each class, respectively.

Goal: Classifying a new image as cat or dog.

Network model: A pretrained convolutional neural network known as VGG16 is used to extract features of each image in the small set of cat and dogs. The network of VGG16 is shown in the following figure:

ooo

The resulting loss and accuracy are shown in the following figures.

ooo

ooo

Modification:

  1. To increase the accuracy, data augmentation can be used. To this end, the output of the VGG16 model is first falttened as a vector and then fed into a fully connected layer of 256 units and finally it is is connected to output layer. Freezing the convolutional base and then training the entire end-to-end deep neural network is done using GPU. The resulting loss and accuracy are shown in the following figures:

ooo

ooo

  1. Fine-tuning: To further improve the accuracy, the trained model in the previous step is used again and then the last layer in the convolutional base is unfreezed and these layers together with fully connected layers are trained again. The resulting loss and accuracy are shown in the following figures:

ooo

ooo

The source code of this project is available in my Github page.