Face Recognition with Labeled Faces in the Wild dataset

TL, DR: Used subset of Labeled Faces In the Wild dataset to attempt Face recognition. Hit a brick wall as the number of people got progressively higher (accompanied by a lesser number of images per person).

Data collection: There are a total of 13233 images and 5749 people in the database, and each face has been labeled with the name of the person pictured. The number of images per person varies a lot, most of the people have just one image. For eg., there were only 62 people with 20 images each. I used some pandas/scripting to group the images into 4 sets so that they could be classified (train and valid folders)

lfw-100 - 5 people with 100 images per person, 90 training/10 validation
lfw-20 - 62 people with 20 images per person, 15 training/5 validation
lfw-10 - 158 people with 10 images per person, 7 training/ 3 validation
lfw-5 - 423 people with 5 images per person, 4 training/1 validation

I’ve uploaded the data to GitHub (lfw-classification) with all the accompanying Jupyter files, so they should be reproducible

These are the best results after several hours of iterations using most of the techniques discussed (used only dropout, no other regularization yet)

lfw-100 - 5 people with 100 images per person, 90 training/10 validation : 94% :slight_smile:
lfw-20 - 62 people with 20 images per person, 15 training/5 validation: 89%
lfw-10 - 158 people with 10 images per person, 7 training/ 3 validation: 71.5%
lfw-5 - 423 people with 5 images per person, 4 training/1 validation: 48% :frowning:

One major question I have is …how ‘bad’ is 48% in terms of FaceID detection? Since 48% of the time, the model is correctly predicting 1 from 423 classes with just training 4 images per class.

Another major learning (re-learning I should say) is that the model is very sensitive to learning rate. This is more important with small data-sets since I could not effectively use the lr_find - the number of validation images was too less, or the plot was too ‘coarse’. @jeremy maybe something worth looking into? For eg., for lfw-10 the plot is as shown.

Here are some of the iterations I went through for lfw-20:
image

I seem to have hit a plateau after reaching the accuracy numbers above. Are there any other things/techniques I could use? Suggestions welcome!

7 Likes

It’s been a long time since I’ve looked at face recognition, so I don’t know the benchmarks (you could check a couple of recent papers that use this dataset to see), but 48% accuracy on 423 classes with 4 examples sounds pretty good, to me. Note that normally people use siamese networks for face recognition, which we haven’t studied yet.

You could use a smaller batch size, and also pass a higher starting LR to lr_find. Does that help?

BTW @slavivanov you might be interested in the table above, showing great results from differential learning rates.

2 Likes

Thanks for the Siamese NW idea! I’ll explore that. This was the first problem that didn’t give me great results within the first 15 minutes:)

I’ll try with a smaller batch size, I think that should work, those cases with more valid images in dataset gave better lr_find graphs in general.

If you can’t get good results in <15 mins it’s not worth doing :wink:

3 Likes

Thanks for the tips @jeremy! FYI I wasn’t able to open the CIFAR jupyter notebook, seems to be unreadable.

I did read up on the Siamese Networks. Looks like
a) same model (sn) will need to take in 2 images as input one after the other
b) Calculate a contrastive loss function, from output of sn(pic1, pic2)
c) Backpropagate this loss and update weights.

1 Like

Thanks for letting me know - fixed now.

Great description of siamese nets - exactly right.

1 Like