Unsupervised Face Clustering in opencv

asked 2015-09-17 09:07:43 -0500

adjorlu gravatar image

updated 2015-09-18 03:57:13 -0500

I have implemented the following using opencv algorithms:

  1. Face detection using haar-cascade. saving the cropped and re-size face image in a folder.
  2. Manually clustering the faces in their own folder. Jonas faces will go in "Jonas" folder and Pernilles faces go into "Pernille" folder manually.
  3. code that automatically creates a CSV file based on the folder structure. A csv file to be used by a face recognition algorithm to train on
  4. Eigenfaces that trains on the database and can recognize those faces. this performs really well!

My problem is step 2. I want the system to run without any supervision. So what can I do to place each face in its own specific folder without me having to manually placing "Jonas" in a "Jonas" folder and "Pernille" in the "Pernille" folder. In other words, how can I get a unsupervised face clustering op and running in OpenCV? :)

A similar solution to the suggested [unsupervised face clustering].(http://bitsearch.blogspot.dk/2013/02/unsupervised-face-clustering-with-opencv.html)
However their proposed solution, as they state it in the blog is not working properly.

Any help is greatly appreciated!

edit retag flag offensive close merge delete


IMHO you should apply your recognition algorithm and based on its prediction do the sort. For saving images you may use imwrite

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-09-17 11:01:12 -0500 )edit

some things to try (just don't expect more than 80% accuracy, still some manual work nessecary):

  • kmeans (supervised, but good if you halfway know K)
  • EM . do a full train(), and just don't give it any K. (should result in a list of labels)
  • partition - obviously, the distance function is crucial (needs a lot of 'trying out')
  • i've seen some blog post somewhere, abusing opencv's (LBPH) face recognition like in - add a picture and a (dummy) label in update(), see what the prediction returns, adjust the label.
berak gravatar imageberak ( 2015-09-17 17:51:09 -0500 )edit

Thansk guys! However, I need a completely unsupervised methods such as the one described [in this blog]. (Perhas this is what you refer to Berak? (http://bitsearch.blogspot.dk/2013/02/...)

However, their solution is not performing good enough.

adjorlu gravatar imageadjorlu ( 2015-09-18 03:47:53 -0500 )edit

yes, exactly. that's what i meant with option 4.

"However, their solution is not performing good enough." - yes, my experience, too.

again, this is a real hard problem, solving it properly would be phd stuff ;) (or say, same amount of work)

berak gravatar imageberak ( 2015-09-18 03:58:23 -0500 )edit

Funny you mention it, I have actually applied for phd funding for a project that might require this unsupervised :)

Hopefully a suitable solution will come up soon...

adjorlu gravatar imageadjorlu ( 2015-09-18 04:50:01 -0500 )edit