0

Good evening everyone,

I have tried to use this

Keep in my that my Ptr variable is of type BasicFaceRecognizer as per OpenCV 3.0 documentation: http://docs.opencv.org/master/db/d7c/group__face.html#gsc.tab=0

Ptr<BasicFaceRecognizer> model;    
int label = -1;
double confidence = 0.0;
this->imageManager = pManager;
this->model = createEigenFaceRecognizer();
this->model->train(pManager->getOpenCVTrainImages(), pManager->getTrainLabels());

for(Mat& imageToTest : pManager->getOpenCVTestImages())
{
    this->model->predict(imageToTest, label, confidence);
    cout << "Class: " << label
        << " The confidence predicted towards the test image is: " << confidence << endl;
}

When running this code, it correctly identifies the label (which is a good thing) however, if the test image is run against a subset not part of its class I was expecting to receive a class of -1 or a really LOW confidence.

In this example I have not set the face recognizer to 10 PCA components and I did not set a threshold. However, I have tried to run it with a createEigenFaceRecognizer(10, 123.0) or createEigenFaceRecognizer(10, 50.0) or createEigenFaceRecognizer(0, 1.0)...

All of the above return me a confidence of 0. Which seems very unlikely or impossible I was expecting at least a few numbers.

What am I doing wrong, is this a bug?

Chris
  • 36
  • 1
  • 6
  • the "confidence" is actually the distance, quite the opposite of what you'd expect – berak Nov 13 '15 at 06:12
  • this would make sense to me. However, even after training upon retrieving my eigenvalues and eigenvectors are all zero. This is what puzzles me. Obviously, if these values aren't calculated the distance would not be zero especially if the test image is NOT at all similar to the trained images... – Chris Nov 13 '15 at 16:04

0 Answers0