Yet Another GSoC update : libface gets Face Recognition

So now that the GSoC community bonding period (the official one, I mean ;)) is coming to a close, I guess that a small report of my work so far is warranted.

To those who do not know: As part of my GSoC work, I’m committing to libface , an open-source face recognition library made by me and my mentor Alex Jironkin. libface shall be used for the upcoming Face Detection and Recognition support in digiKam.

I finally got around to committing a proper Eigenfaces implementation in libface. To the uninitiated, Eigenfaces is a subspace method for face recognition, that uses PCA for dimensionality reduction in the training set. You can learn more here.

Face detection is done using stock haar cascades that come bundled with OpenCV. An analysis of speed – if you have a pretty slow (1.6 GHz) computer and have set the accuracy to what shall be called 100% in libface (no, it will never be 100% in practice ;)), it’d take a max of 6 seconds per photo – which means less than a day for 10,000 photos, and about a week for 100,000 photos (seriously, not many people have 100,000 photos in their collection) – provided you start from scratch. I find the speed to be comparable to Picasa on my computer. I used a timer for that 🙂

The accuracy of detection is, IMHO, similar to Picasa. Now, there’s no concrete way to test that in Picasa, but I find Picasa to encounter the same problems with faces rotated in 3D. There’s always some faces that one detects but the other does not. Alex gives me similar feedback about iPhoto.

Note: Blog posts suck wihout an image, so here’s one :

A photo of KOffice developers, revealed by a random google search.

Next – Face Recognition. As my fellow GSoC candidate Kunal Ghosh for this project rightly pointed out, updating the trained database of faces with a new face requires retraining of the entire database, if you use Eigenfaces. We used a simple workaround for that – we store faces in multiple databases – each DB is a chunk of 50 faces. Updating one database (50 new faces in one go) takes only about 1 second (you’re supposed to say WOW there) on my 1.6 GHz laptop. So it can be agreed upon that speed is not much of an issue with training.

There are issues with recognizing faces with 3D rotation, Although this isn’t decided at the moment, I might apply GLR (Global Linear Regression) for that. This technique, as described in the paper you just downloaded (if you clicked on that link), can be applied to the problem at hand, to generate a virtual frontal face from a rotated face.

And tagging. I’ve just checked out a fresh copy of Adrian Bustany’s nepomuk-peopletag project, which has been abandoned since about two years or so. I’ll be modifying it – actually it involves removal of code, not much actual coding. I’ll be removing the nepomuk-specific code from it (no offense to the Nepomuk people), as digiKam shall talk to Nepomuk through it’s own interfacing.

I’ll be posting a video demonstrating Picasa’s and libface’s detection side-by-side soon!

PS: I test my code on posters of LOST. Can’t upload here, for issues of copyright. If any of the people above have an issue with the pic, just let me know, I’ll change it 🙂