Ah well, today marks a month since the official GSoC coding period started.

Brief intro: I’m working on implementing automatic tagging of faces for digiKam, with face detection and recognition. For that, I’ve been working on a library named libface that does the detection and training/recognition.

At some point, it was deemed necessary to make a Qt wrapper for libface, so that Qt/KDE programs could easily use it. This has been now (almost) done, and the resulting library is named libkface. libkface will be put somewhere in kdegraphics/libs as soon as the API freeze is over (I think), and will be usable not only by digiKam, but also by other programs like KPhotoAlbum.

We’re also going to keep the lib(k)face database in a shared directory, so that all programs that may use it can share the same training data. That way, a user migrating from digiKam to KPhotoAlbum (hypothetical, with face recog) would not have to retrain libkface with his entire collection.

In branches/extragear/graphics/digikam/libkface/test/gui/, I have made (with help from Alex) a simple GUI for playing with libkface:

It has a few buttons for the usual operations. Mind you, this is NOT going to be the way digiKam will present it’s interface to you, so don’t be afraid :D. With my last commit, I have added support in libface for “tunable accuracy” for face detection. Look at the slider above the photo – you can set the accuracy of detection on a Five-point scale. 1 gives you very low accuracy, but insanely high speed. Setting the accuracy to 5 gives you very high accuracy, but very low speed.

From what I’ve observed :

Accuracy of 1 : ~0.8 seconds.

Accuracy of 2 : ~2.1 seconds

Accuracy of 3 : ~4 seconds

Accuracy of 4 : ~7 seconds

Accuracy of 5 : ~13-15 seconds

The default accuracy is kept as 3.

This is a slight improvement from when I blogged about it last time. A nice use-case for this is – if you have a weak/slow computer, you can set the accuracy to 2. 1 is waaay too less, only for waaay slow computers, but in that case you probably shouldn’t be using face detection anyway. My laptop isn’t exactly powerful, and 3 works best. For those of you with newer laptops, you can go for 4. 5 is for those who have obscenely large amounts of processing power.

In the screenshot above, the red frame and the nice little black rectangle you can see is the embryo of the tagging widget I’m making. You can edit the name and all. In the next few days, I’ll be adding Tick/Cross buttons near the text, and making the face rectangle resizable.

In all, this week was quite productive, and I must also thank Marcel (patches, code review), Gilles (Porting libkface from qmake to CMake), and Alex (CMake porting and some code) for their help.