Face Recognition Confidenece

1,155 views
Skip to first unread message

jaydeep joshi

unread,
Jan 4, 2015, 2:38:38 AM1/4/15
to jav...@googlegroups.com
I am trying to do face recognition using LBPHFaceRecognizer. I am resizing all the faces(both the training images and image to compare) to same size and then calling cvEqualizeHist 
and I am getting confidence value and label name by doing the following:

                                        double[] prediction = new double[1];
                                        int[] predictionImageLabel = new int[1];
                                        faceRecognizer.predict(userFace, predictionImageLabel, prediction);

But the confidence value is always greater than 80. Based on whatever I read lower the confidence value greater are the chances that the image is of the same person. But in my case even if  the person is different it sometimes gives confidence as 80-100. What should be the range of confidence value which I should consider to decide whether its the same person or not.

Samuel Audet

unread,
Jan 4, 2015, 6:39:53 AM1/4/15
to jav...@googlegroups.com
On 01/04/2015 04:38 PM, jaydeep joshi wrote:
> But the confidence value is always greater than 80. Based on whatever I
> read lower the confidence value greater are the chances that the image
> is of the same person. But in my case even if the person is different
> it sometimes gives confidence as 80-100. What should be the range of
> confidence value which I should consider to decide whether its the same
> person or not.

This is just a guess, but you're probably going to need to train your
classifier with more data. Check out this tutorial for all the details:
http://docs.opencv.org/modules/contrib/doc/facerec/facerec_tutorial.html

Samuel

jaydeep joshi

unread,
Jan 5, 2015, 3:34:21 AM1/5/15
to jav...@googlegroups.com
Thanks Samuel.. I was giving different label names to training images of same model. Now, I have changed but still confidence value starts from 60. For every model I'm having 5 images. For now as a quick fix I've given threshold for my faceRecognizer as:
faceRecognizer.set("threshold", 80);
Since other persons image is also getting identified as same person and I found usually the confidence value in such case is above 80. So, just a fix for now I did that, which may not be the apt way of doing. Do you think just increasing the number of training data for every model will help cause in opencv link they are taking around 10 images per model and I am just using 5

jaydeep joshi

unread,
Jan 5, 2015, 4:26:22 AM1/5/15
to jav...@googlegroups.com
One more doubt is there any way by which I can convert opencv Mat to IplImage of javacv and vice versa. Currently I am converting Mat to BufferedImage then again converting it to IplImage.


On Sunday, 4 January 2015 17:09:53 UTC+5:30, Samuel Audet wrote:

Samuel Audet

unread,
Jan 6, 2015, 6:49:27 AM1/6/15
to jav...@googlegroups.com
On 01/05/2015 05:34 PM, jaydeep joshi wrote:
> Thanks Samuel.. I was giving different label names to training images of
> same model. Now, I have changed but still confidence value starts from
> 60. For every model I'm having 5 images. For now as a quick fix I've
> given threshold for my faceRecognizer as:
> faceRecognizer.set("threshold", 80);
> Since other persons image is also getting identified as same person and
> I found usually the confidence value in such case is above 80. So, just
> a fix for now I did that, which may not be the apt way of doing. Do you
> think just increasing the number of training data for every model will
> help cause in opencv link they are taking around 10 images per model and
> I am just using 5

Does it work properly if you use the training data from the tutorial? If
it works well, then it's a problem with your data. If it doesn't work
well even with the data from the tutorial, it might be a problem with
JavaCPP, so please let me know! Thanks

> One more doubt is there any way by which I can convert opencv Mat to IplImage of javacv and vice versa. Currently I am converting Mat to BufferedImage then again converting it to IplImage.

These are all the methods you need for these kinds of conversion:

http://bytedeco.org/javacpp-presets/opencv/apidocs/org/bytedeco/javacpp/opencv_core.Mat.html#Mat-org.bytedeco.javacpp.opencv_core.IplImage-
http://bytedeco.org/javacpp-presets/opencv/apidocs/org/bytedeco/javacpp/opencv_core.Mat.html#asIplImage--
http://bytedeco.org/javacpp-presets/opencv/apidocs/org/bytedeco/javacpp/helper/opencv_core.AbstractArray.html#getBufferedImage--
http://bytedeco.org/javacpp-presets/opencv/apidocs/org/bytedeco/javacpp/helper/opencv_core.AbstractMat.html#createFrom-java.awt.image.BufferedImage-
http://bytedeco.org/javacpp-presets/opencv/apidocs/org/bytedeco/javacpp/helper/opencv_core.AbstractArray.html#copyFrom-java.awt.image.BufferedImage-
http://bytedeco.org/javacpp-presets/opencv/apidocs/org/bytedeco/javacpp/helper/opencv_core.AbstractIplImage.html#createFrom-java.awt.image.BufferedImage-

Samuel

Message has been deleted

jaydeep joshi

unread,
Jan 6, 2015, 9:44:11 AM1/6/15
to jav...@googlegroups.com
Thanks for your reply. I trained FaceRecognizer object with Yale Facedatabase A and tried to recognize my face and it recognized with subject02, subject04 and subject07 till now giving confidence value around 72, 83 and 68 respectively. I followed the same process as I did previously for training data and while recognizing:
  • Cropped face from images
  • Resized all faces to uniform resolution
  • Used cvEqualiseHist on those faces
I also tried using EigenFaceRecognizer, there it gave me confidence values between 4000-6000 when using Yale Facedatabase A and 2800-3600 when trying with my actual images(what I could found till now).

Samuel Audet

unread,
Jan 10, 2015, 8:28:29 AM1/10/15
to jav...@googlegroups.com
On 01/06/2015 11:44 PM, jaydeep joshi wrote:
> Thanks for your reply. I trained FaceRecognizer object with Yale
> Facedatabase A <http://vision.ucsd.edu/content/yale-face-database>and
> tried to recognize my face and it recognized with subject02, subject04
> and subject07 till now giving confidence value around 72, 83 and 68
> respectively. I followed the same process as I did previously for
> training data and while recognizing:
>
> * Cropped face from images
> * Resized all faces to uniform resolution
> * Used cvEqualiseHist on those faces
>
> I also tried using EigenFaceRecognizer, there it gave me confidence
> values between 4000-6000 when using Yale Facedatabase A
> <http://vision.ucsd.edu/content/yale-face-database> and 2800-3600 when
> trying with my actual images(what I could found till now).

If you're having problem with your own custom data, that's something you
should the author of that module: Philipp Wagner <bytefish[at]gmx[dot]de>.

If you're also having problems even when using only the data from the
tutorial, let me know, and I'll look into it, thanks!

Samuel

jaydeep joshi

unread,
Jan 16, 2015, 3:54:29 AM1/16/15
to jav...@googlegroups.com
Thanks Samuel !!

yakup irim

unread,
Jan 12, 2018, 6:45:53 PM1/12/18
to javacv


6 Ocak 2015 Salı 17:44:11 UTC+3 tarihinde jaydeep joshi yazdı:
 Hi
        I have same problem on confidence value. Did you solve this stiuation? How can we set threshold value?
        Thanks.

yakup irim

unread,
Jan 12, 2018, 6:45:53 PM1/12/18
to javacv
I have same problem for confidence value. Did you solve it? How can we decide confidence value.

4 Ocak 2015 Pazar 10:38:38 UTC+3 tarihinde jaydeep joshi yazdı:
Reply all
Reply to author
Forward
0 new messages