igorcoroli / javacv

Automatically exported from code.google.com/p/javacv
GNU General Public License v2.0
0 stars 0 forks source link

Confidence value at FaceRecognition returns invalid values #252

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a new database file trained with 6 pictures of myself (all of them 
with same size 240x320px)
2. Using the previous created database of myself, try to validate 3 new 
pictures, one of me, and 2 of other people.

What is the expected output? What do you see instead?
I expect that a confidence value of 0.5 to 1.0 to my picture and less than 0.5 
for the other 2 pics.
This are the values returned:
Picture of myself -2.69888
Person A: -1.2406 
Person B: -3.58343

What version of the product are you using? On what operating system?
OpenCV 2.4.2
JavaCV 0.2
OS: Windows 7 64bits

Please provide any additional information below.
I have attach log file.

Original issue reported on code.google.com by leadi...@gmail.com on 19 Oct 2012 at 9:02

Attachments:

GoogleCodeExporter commented 8 years ago
Do you have a few lines of code to share?

Original comment by samuel.a...@gmail.com on 20 Oct 2012 at 1:00

GoogleCodeExporter commented 8 years ago
Thanks for answer, I am using the example app FaceRecognition.java (attached) 
that I get from 
http://code.google.com/p/javacv/source/browse/samples/FaceRecognition.java

On the method findNearestNeighbor you can find this formula:

float pConfidence = (float) (1.0f - Math.sqrt(leastDistSq / (float) 
(nTrainFaces * nEigens)) / 255.0f);

Shervin Emami writes about it: "in fact it is not
a reliable confidence metric, thats why on my webpage I mention that
it is only useful in some situations and if you find that it is not
giving a good value for your data then please ignore it"

I look for another way to get a confidence value but I wasn't success.

thanks for any help you can provide, I am stuck and I need help to get a good 
confidence value.

Original comment by leadi...@gmail.com on 20 Oct 2012 at 1:49

Attachments:

GoogleCodeExporter commented 8 years ago
Ah, this would be a question for either Stephen Reed or Shervin Emami, have you 
tried contacting them about that?

BTW, new versions of OpenCV now come with a better FaceRecognizer:
http://code.google.com/p/javacv/source/browse/src/main/java/com/googlecode/javac
v/cpp/opencv_contrib.java#846

Original comment by samuel.a...@gmail.com on 20 Oct 2012 at 2:28

GoogleCodeExporter commented 8 years ago
Assigning to Shervin: Please provide an answer if you can, thank you.

Original comment by samuel.a...@gmail.com on 2 Feb 2013 at 1:34

GoogleCodeExporter commented 8 years ago
We decide to no use this implementation and change it for new API 
FaceRecognizer.
FaceRecognition.java is not enough accurate.

Thanks

Original comment by leadi...@gmail.com on 2 Feb 2013 at 1:41

GoogleCodeExporter commented 8 years ago
Yes the confidence formula in my old face recognition code can give strange or 
useless values, some people are happy with it but some people are getting very 
bad confidence values, so I recommend ignoring it if it is not good for your 
conditions.

The new FaceRecognizer in OpenCV v2.4.2 onwards is better than my old face 
recognition code, because it is easier to use, and it works with more 
algorithms (Eigenfaces, Fisherfaces or LBPH). But it also has a bad confidence 
formula.

I wrote a new face recognition tutorial & code for the new "Mastering OpenCV" 
book, it uses OpenCV's new FaceRecognizer module but with a better confidence 
metric than the OpenCV one. So I recommend using the new FaceRecognizer module 
and including the confidence metric I used in the Mastering OpenCV book.

Original comment by shervin.emami@gmail.com on 4 Feb 2013 at 7:59

GoogleCodeExporter commented 8 years ago
Sounds good, so we'll mark this as "done", I guess. Thanks!

Original comment by samuel.a...@gmail.com on 5 Feb 2013 at 1:07

GoogleCodeExporter commented 8 years ago
hi everyone,
https://code.google.com/p/javacv/source/browse/samples/FaceRecognition.java?r=02
385ce192fb82f1668386e55ff71ed8d6f88ae3&spec=svn42b41d0a1b208ab9a8cf71b1830cad1f8
172ce0f
i have gone through the code of above link for face recognition and in that  
code:
public static void main(final String[] args) {

    final FaceRecognition faceRecognition = new FaceRecognition();
    //faceRecognition.learn("data/some-training-faces.txt");
    faceRecognition.learn("data/all10.txt");
    //faceRecognition.recognizeFileList("data/some-test-faces.txt");
    faceRecognition.recognizeFileList("data/lower3.txt");
what is the content to be there in all10.txt
help me out with the issue.
Thanks in advance.

Original comment by alluri.r...@gmail.com on 13 Aug 2013 at 12:17

Attachments:

GoogleCodeExporter commented 8 years ago
It comes from the section "How to use the offline cmd-based FaceRec system" on 
the page "http://www.shervinemami.info/faceRecognition.html". You can get the 
file if you download facerecExample_ORL.zip (1kB) and if you want to images you 
can download Cambridge_FaceDB.zip (3.7MB) too.

Original comment by shervin.emami@gmail.com on 13 Aug 2013 at 12:33

GoogleCodeExporter commented 8 years ago
Hi Shervin,
Thanks for the quick response. when i was installing OnlineFaceRec.exe for  
unzipping  the 'Cambridge_DB' database ..i 'm facing a system error saying 
missing opencv_core231.dll.
i have added that .dll in my system32 folder and as well as in my opencv .
but my problem is not resolved .
help me if you have any idea .
Thank you.

Original comment by alluri.r...@gmail.com on 14 Aug 2013 at 5:26

GoogleCodeExporter commented 8 years ago
hi,
when i was debugging and running the code of faceRecognition.java
control is going throwing a runtime exception and stucked in the below line of 
code .
if (faceImgArr[iFace] == null) 
{
throw new RuntimeException("Can't load image from "+ imgFilename);
}
i have even attached my screens that i debugged.
do reply me in solving my problem.
thank you.

                }

Original comment by alluri.r...@gmail.com on 14 Aug 2013 at 7:56

Attachments:

GoogleCodeExporter commented 8 years ago
 screen for main(). 

Original comment by alluri.r...@gmail.com on 14 Aug 2013 at 9:04

Attachments:

GoogleCodeExporter commented 8 years ago
I think all of these problems might just be from running in the wrong folder. 
Either figure out which folder it is running from and move your files to it, or 
change the setting to where you want it to start from. For the problem with 
OnlineFaceRec.exe, you don't need my OnlineFaceRec program if you just want the 
database to use from JavaCV, you just need the database (image files + text 
files). (I mentioned the 2 filenames in my post above).

Original comment by shervin.emami@gmail.com on 14 Aug 2013 at 11:48