Week 7 Reloaded - Fine-tuning VGG16 model for CIFAR-10 dataset
Week 7 is the last week of this deep-learning plan. And I didn’t want to finish before trying a bit more to have better results. So here we go again.
This time I learned two things: Google Colaboratory and Lambda layer. Those two have helped me refactor my code in two notebooks to get better results.
Because my computer was so slow to process such dataset, I didn’t have the luxury of experimenting with models and hyperparameters. So one obvious step was to look for an online solution to process my python code with an acceptable speed. Google Colaboratory was a nice and free solution that fitted my needs.
If you haven’t used it before, here is a nice tutorial
This processing power allowed me to rerun a previous notebook to train my own CNN for CIFAR-10 dataset. But for 100 epochs instead of only 15. This allowed me to see how my model was performing well enough to reach an accuracy of 82.68%. (compared to 74.53% with 15 epochs)
You can find the whole python notebook for my own model on Github here.
Fine-tuning VGG16 model
Now that I had Google Colaboratory, I could try a huge number of changes in different hyperparameters and layers customization. After a couple of days of trying, I could get a maximum accuracy of 73.33%. (compared to 68.03% with less tinkering).
This was the maximum test accuracy I could get. After that, the model was just overfitting to reach 90 something % training accuracy and no test accuracy improvement. I could go further and inject normalization and dropout layers. But that was enough for me for that part of my homework.
I could also solve my problem of not having enough memory to resize all the data and having to use part of it. This was possible by using a
Lambda layer as an input and use it to
Reshape every batch. Another solution was to use
ImageDataGenerator. But I didn’t have to use it for now.
You can find the whole python notebook for a customization of VGG16 on Github here.
Instead of spending more time tinkering with an existing model to reach a result that I could reach easier with my own model, I thought it is not worth it. Of course I already achieved the purpose of this homework to recycle an existing model and adapt it to my needs. Now it was time to move on.
Next is to find a real-world problem and work on it with real-world data to achieve an acceptable solution. And this new solution should not only be a quick and dirty bunch of python files, but rather a proper project with coding standards and a user-friendly interface. This way, I can learn even more and sharpen my skills.
- 37 Reasons why your Neural Network is not working
- VGG16 fine tuning: low accuracy
- Resizing an input image in a Keras Lambda layer
- Google Colab Free GPU Tutorial