Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

face recognition prediction returns the same value

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 displaying 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?

click to hide/show revision 2
retagged

updated 2014-03-04 03:14:27 -0600

berak gravatar image

face recognition prediction returns the same value

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 displaying 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?

face recognition prediction returns the same value

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 displaying

  • label 1 = ~500 ~500
  • label 2 = ~2000 ~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?

click to hide/show revision 4
retagged

updated 2014-03-04 03:17:37 -0600

berak gravatar image

face recognition prediction returns the same value

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 displaying

  • 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?

face recognition prediction returns the same value

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 displaying 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?