Ask Your Question

Updating EigenFaceRecognizer with more faces

asked 2013-02-22 01:34:14 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >50 is welcome to improve it.

Hello All,

I am trying to develop a small application for FaceRecognition in the lines of Android's FaceUnlock. There are two parts of the application.

(1). A model_creator would read the faces to create a model and train it.The model would be saved to a file (say Faces.db).

(2). A predictor would load the same file (Faces.db) and try to make prediction from incoming face captures.

The mode_creator and predictor can be invoked when needed but they both do not run at the same time.

For EigenFaceRecognizer, I would like to add more faces for an existing person or a new person to the model. I understand from the documentation that EigenFaceRecognizer and FisherFaceRecognizer do not support update() method.

How could the model be provided more faces?



edit retag flag offensive close merge delete

3 answers

Sort by ยป oldest newest most voted

answered 2013-02-22 03:13:06 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >50 is welcome to improve it.

the eigen and the fisher (wich is an extension of eigen) methods calculate a state from ALL the train images (a huge pca matrix in the eigen case , combination of pca & lda with the fisher one),

so, they have to get retrained, if you want to add another image. (might explain, why there's no update method)

you can save the outcome to an xml/yml file, (that would be your faces_db), but those tend to be quite huge, (like 5mb for 100 imgs) so maybe zip that for storage. personally, i found, that retraining from the original img set was faster, than loading from yml, but that's on a beefy pc, not on a smartphone.

oh, and please have a look at the 3rd method, the lbph one, gave nicer results in my case(very noisy backgrounds, stuff from tv/outdoors/real life)

ps, you're not alone with that problem here, dig a bit around on this site for comments/answers from philip wagner(bytefish), the man who wrote that stuff. he's awesome at explaining such things!

edit flag offensive delete link more


Hi Berak, Thanks for answering the questions! I am in hospital at the moment and won't be able to post the weeks ahead.

Philipp Wagner gravatar imagePhilipp Wagner ( 2013-02-22 08:01:05 -0500 )edit

oh, gute besserung ;)

berak gravatar imageberak ( 2013-02-22 08:12:17 -0500 )edit

answered 2013-02-25 05:28:27 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >50 is welcome to improve it.

Actully, I have faces of 4 persons (15 samples per person). Yes I understand that eigen or fisher requires much more data. Philipp mentioned that eigen/fisher operate on high-dimensional image space so I am kind of avoiding them if possible.

Since I am trying with LBPH, I guess 15 images would be enough (Not sure though). I am following code of GitHub ( written by Shervin.

I did normalization and equalizeHist similar to that code and Model threshold has been set to 100.0 as below

model->set("threshold", 100.0);

With these I got success in prediction upto 70% with confidence values around 45 to 70. I will try out by changing some more parameters. Hopefully get some better results.



edit flag offensive delete link more

answered 2013-02-25 04:36:58 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >50 is welcome to improve it.

Thank you Berak

I have been following face recognition tutorials written by Philipp Wagner and Shervin Emami. As you suggested about retraining, I am using original images instead of yml/xml file.
I am experimenting with LBPH FaceRecognizer. I found it interesting. Around 70% times, it predicts correct(I have faces of 4 persons for comparison) but I would like the results to converge more than 90-95%. Probably, I will have to to tune some parameters like threshold, radius etc.

Any clue in that direction?

What does confidence mean? Higher confidence is better or lower?



edit flag offensive delete link more


maybe 4 reference persons is not enough. also, how many images for each did you use ? 5 - 30 seemed good for me.

  • more face datasets, for experimenting:

lbp is different again here, since one result does not depend on the other. but still, the more pics per person, the better the recognition.

to get better results: normalizing or equalizeHist on the grayscale ones did wonders for me

higher confidence == better.

berak gravatar imageberak ( 2013-02-25 04:47:38 -0500 )edit

It seems setting threshold around 50.0 gives me better results. BTW, Had one question. I looked into LBPH::predict method of OpenCV. From the code, it seems that confidence is minDist so shouldn't it be other way round. I mean lower confidence is better.

Soaptechie gravatar imageSoaptechie ( 2013-02-27 00:44:43 -0500 )edit

aaaww, confused distance with confidence here. you're right.

berak gravatar imageberak ( 2013-02-27 01:27:50 -0500 )edit
Login/Signup to Answer

Question Tools


Asked: 2013-02-22 01:34:14 -0500

Seen: 1,425 times

Last updated: Feb 25 '13