Monday, November 7, 2016

Can the LeNet model handle Face Recognition?

I recently followed a blog post - at PyImageSearch by Adrian Rosebrock - on using the LeNet Convolutional Neural Network model on the MNIST dataset - i.e. use for handwritten digit recognition - using Keras with Theano backend. I was able to easily try it out thanks to the very detailed and well thought out guide.

The LeNet model itself is quite simple, just 5 layers. Yet it performs impressively well on the MNIST dataset. We can get around 98% accuracy with just 20 iterations of training with ease.

The training time for the model is also quite low. I tested on my MSI GE60 2PF Apache Pro laptop with CUDA enabled, and the training time was just 2 minutes 20 seconds on average. On CPU only (with CUDA disabled) it took around 30 minutes.

LeNet giving 98% accuracy on MNIST data
LeNet giving 98% accuracy on MNIST data
As you can see, we got 98.11% accuracy, and it has correctly classified a digit that has been cut-off.

It even classifies a quite deformed '2' correctly.
LeNet correctly classifying a deformed digit
LeNet correctly classifying a deformed digit

Rarely, it will classify a digit incorrectly, such as seen below,
A rare mis-classification in LeNet
A rare mis-classification
Note: I had to run the test many, many times to get it to mis-classify this one.

With this amount of accuracy, LeNet - one of the smallest convolutional neural network models - shows the power of Deep Learning algorithms.

So, I was wondering how LeNet would perform with a more complex task - Face Recognition, using raw pixel intensities of face images.

I built a training set of 10 faces, with ~500 images each for training. Used the same LeNet model, only adjusting the input shape to accommodate the size of the training images of my training set. Following is the result,
LeNet giving a 99% accuracy on Face Recognition
LeNet giving a 99% accuracy on Face Recognition
I got 99.74% accuracy, which is astonishing.

It turns out the simple model of LeNet can be used for much more.

I will dive into the code I used to get LeNet to work on face recognition in my next post.

Update: I've added a new post - Getting the LeNet model working with Face Recognition - describing the step-by-step code I used to get LeNet working with Face Recognition.

Related links:

No comments:

Post a Comment