Senators Facial Recognition

Fernando Melo
deeplearningbrasilia

--

99% accuracy with Fastai v1 deep learning.

“A facial recognition system is a technology capable of identifying or verifying a person from a digital image or a video frame” (wikipedia).

I created an image classification model using a convolutional neural net to do the facial recognition of the 80 senators from Brazil of the year 2017.

The dataset, created by Fabrício Santana, has a total of 10,000 public images of the senators. Each image has only one senator on it and the photos were cropped to get only their faces as shown below. The classes are unbalanced because some senators have more photos than others. For example, senator Aécio Neves has 325 pictures while senator Maria do Carmo got only 24. For the training phase I used 8,000 images and separated 2,000 images for the the model validation.

I got a fantastic accuracy of 99.3% using Resnet34 pre-trained model with the new fast.ai version. Using the previous fastai version, I reached 98,2% accuracy. It´s good to see that fastai library is always getting better and better.

Among many applications, this model could be used to automatically label photos of the Social Media Department, streamlining and facilitating the work of photographers and reporters who do the journalistic coverage every day. It would also be possible to automatically register the presence of parliamentarians in committee and plenary sessions.

Bellow, You have a link to the notebook, so you can take a look at the code (the code used here is based on fast.ai MOOC that will be publicly available in Jan 2019)…

Jupyter notebook available here: https://bit.ly/2zzo6cC

After loading the dataset, the function ImageDataBunch.from_folder will create the data object with your images, data transformations and image size.

Below, some examples of the senators images:

Here you can see the numbers I got while training the model:

Below, a confusion matrix shows predicted and actuals totals:

With the help of the new Fastai public libraries and Pytorch 1.0, this can be an easy and fast task. You should try it later with your own dataset.

Fernando Melo

Twitter: https://twitter.com/Fmelobr

linkedIn: https://www.linkedin.com/in/fernando-melo-a6909720/

--

--

Fernando Melo
deeplearningbrasilia

Data scientist @ Senate of Brazil | Founder @ Machine Learning Brasília