CIFAR-10 image classification with Keras ConvNet

(Updated on July, 24th, 2017 with some improvements and Keras 2 style, but still a work in progress)

CIFAR-10 is a small image (32 x 32) dataset made up of 60000 images subdivided into 10 main categories. Check the web page in the reference list in order to have further information about it and download the whole set. Considering our current screen resolutions, it’s not difficult saying that those images are no more than icons and indeed some of them are very hard to be classified even by human beings.

Using Keras, I’ve modeled a deep convolutional network (VGGNet-like) in order to try a classification. I’m still investigating the best architecture (in CIFAR home page, there are very interesting references to papers and other results), however, I think it can be a good starting point. As the output is a softmax layer, it can also be interesting to evaluate mixed results, for example, an image with features belonging both to a dog and a plane and so forth.

convnet

The full script, without any particular image preprocessing step (data augmentation) except for the normalization between 0 and 1, is the following one (you can easily try to change layer features and dimensions):

The validation accuracy reaches 0.79 after 66 epochs when the early stopping terminates the process because the validation loss has stopped decreasing (the final value is about 0.6).

In my experiments, the majority of errors are related to cat-dog or dog-cat distinctions (something absolutely not surprising, considering that most of main features are common to both categories).

The code is always available in GIST: https://gist.github.com/giuseppebonaccorso/e77e505fc7b61983f7b42dc1250f31c8

Reference:

See also:

Lossy image autoencoders with convolution and deconvolution networks in Tensorflow – Giuseppe Bonaccorso

Fork Autoencoders are a very interesting deep learning application because they allow a consistent dimensionality reduction of an entire dataset with a controllable loss level. The Jupyter notebook for this small project is available on the Github repository: https://github.com/giuseppebonaccorso/lossy_image_autoencoder.