face recognition prediction returns the same value

asked 2014-03-04 03:13:46 -0600

Joseph118 gravatar image

updated 2014-03-04 03:21:10 -0600

I have this code that i am running, where it loops into a folder and get all png files and seperate them via labels. The code runs fine however it always return the same label.

        IplImage greyTestImage = IplImage.create(testImage.width(), testImage.height(), IPL_DEPTH_8U, 1);

        FaceRecognizer faceRecognizer = createFisherFaceRecognizer();
        faceRecognizer.train(images, labels);

        cvCvtColor(testImage, greyTestImage, CV_BGR2GRAY);

        int[] plabel = new int[1];
        double[] pconfidence = new double[1];

        faceRecognizer.predict(greyTestImage, plabel, pconfidence);
        int predictedLabel = plabel[0];
        double confidence = pconfidence[0];
        System.out.println("Predicted label: " + predictedLabel + " & confidence: " + confidence);

I have 3 images in the folder with 3 different labels... 1 , 2 , & 3. when i test the application it always return label 1. and the confidence when showing;

  • label 1 = ~500
  • label 2 = ~2000
  • label 3 = ~3000

i assume that all of the labels are compared only to label 1.. what can i do to be able to force the application to check with label 2 and 3 as well?

edit retag flag offensive close merge delete