Just to recall, the dataset is a combination of the Flickr27-dataset, with 270 images of 27 classes and self-scraped images from google image search. In case you want to reproduce the analysis, you can download the set here.
In the last post, I used the VGG-16 pretrained model and showed that it can be trained to achieve an accuracy of 55% on the training 35% on the validation set.
In this post, I will show how to further improve the model accuracy.
Keras (in R) provides a set of pretrained models:
Naturally, it raises the question which model is best suited for the task at hand.
The article 10 advanced deep learning architectures points out that Google Xception model performs better than VGG in transfer learning cases.
In addition to changing the pre-trained model, I wanted to see how data augmentation changes the results.
The function “image_data_generator” takes the input data and randomly alters the original training images.
Here is the code:
I trained the model first 100 epochs on the original training data and added 50 epochs on the augmented (altered) dataset.
Plotting the training history shows that training on the original data results in a validation accuracy of ~57% after 50 epochs. After that the neither the training nor the validation accuracy increases any further. Further training the model on the augmented data (red colored lines) leads to another boost in the validation accuracy.
To sum up, just changing a couple of lines from the previous setup changes the network’s performance significantly. Using a different pre-trained network and adding data augmentation doubles the classification accuracy.
as a sidenote; it appears (to me) that the current DL landscape is very dynamic and fast evolving. It is a safe bet to say that the content of this post is probably outdated in 6 months. Just in the last month the Rstudio/Keras repository has significantly changed;
Excluding merges, 3 authors have pushed 178 commits to master and 178 commits to all branches. On master, 349 files have changed and there have been 5,468 additions and 1,719 deletions.
Kudos to the rstudio-team for the great work on the package.