Menu

Sandeep Face Detector question

spamrefuse
2017-09-09
2017-09-09
  • spamrefuse

    spamrefuse - 2017-09-09

    Hello,

    Meanwhile I'm getting more and more impressed with the capabilities of OpenImaj!

    I now have written a java script that calls functions that implement the Haar, FKE, and CLM face detectors to draw the bounds of each as a comparison, and write the result to an output movie. That works great!

    Then I wanted to add the Sandeep Face Detector, but that does not work as expected.
    Here is how I wrote the Sandeep function:

    public static MBFImage Sandeep(MBFImage frame) {
       SandeepFaceDetector fd = new SandeepFaceDetector();
       List<CCDetectedFace> faces = fd.detectFaces(frame);
       for (CCDetectedFace face : faces) {
          frame.drawShape(face.getBounds(), 3, RGBColour.BLUE);
       }
       return frame;
    }
    

    The line with the "List<>" statement gets an exception error:

    Exception in thread "main" java.lang.NullPointerException
    at org.openimaj.image.model.pixel.HistogramPixelModel.classifyPixel(HistogramPixelModel.java:79)
        at org.openimaj.image.model.pixel.HistogramPixelModel.classifyPixel(HistogramPixelModel.java:44)
        at org.openimaj.image.model.pixel.PixelClassificationModel.classifyImage(PixelClassificationModel.java:62)
        at org.openimaj.image.model.pixel.PixelClassificationModel.predict(PixelClassificationModel.java:88)
        at org.openimaj.image.processing.face.detection.SandeepFaceDetector.generateSkinColorMap(SandeepFaceDetector.java:130)
        at org.openimaj.image.processing.face.detection.SandeepFaceDetector.detectFaces(SandeepFaceDetector.java:209)
        at MyTest.App.Sandeep(App.java:156)
        at MyTest.App.main(App.java:64)
    

    Any idea what could be the reason for this exception?

    Thanks.
    R.

     
  • Anonymous

    Anonymous - 2017-09-09

    I'll have to look into that.- there shouldn't really be any reason for it not to work. That being said, the SandeepFaceDetector is likely to have pretty bad detection performance compared to the others - it's based on a really simple, but not particularly robust idea.

     
  • spamrefuse

    spamrefuse - 2017-09-10

    Instead I tried another initialization for SandeepFaceDetector:

    public static MBFImage Sandeep(MBFImage frame) {
            FaceDetector<CCDetectedFace,MBFImage> fd = new SandeepFaceDetector();
            List<CCDetectedFace> faces = fd.detectFaces(frame);
    
            String text = "SD ";
            if (faces.size() == 0) text += "X ";
            else SD_count++;
            text += Integer.toString(SD_count);
            frame.drawText(text, 5, 125, HersheyFont.TIMES_BOLD, 25, RGBColour.BLUE);
    
            for( CCDetectedFace face : faces ) {
                frame.drawShape(face.getBounds(), 3, RGBColour.BLUE);
            }
            return frame;
        }
    

    But the error is same:

    Exception in thread "main" java.lang.NullPointerException
        at org.openimaj.image.model.pixel.HistogramPixelModel.classifyPixel(HistogramPixelModel.java:79)
        at org.openimaj.image.model.pixel.HistogramPixelModel.classifyPixel(HistogramPixelModel.java:44)
        at org.openimaj.image.model.pixel.PixelClassificationModel.classifyImage(PixelClassificationModel.java:62)
        at org.openimaj.image.model.pixel.PixelClassificationModel.predict(PixelClassificationModel.java:88)
        at org.openimaj.image.processing.face.detection.SandeepFaceDetector.generateSkinColorMap(SandeepFaceDetector.java:130)
        at org.openimaj.image.processing.face.detection.SandeepFaceDetector.detectFaces(SandeepFaceDetector.java:209)
        at org.openimaj.image.processing.face.detection.SandeepFaceDetector.detectFaces(SandeepFaceDetector.java:66)
        at MyTest.App.Sandeep(App.java:154)
        at MyTest.App.main(App.java:64)
    

    R.

     
  • Jonathon Hare

    Jonathon Hare - 2017-09-13

    The primary issue seems to have been that the saved binary skin classification model had become out of date with the classes that it uses. I've just committed a fix. I also noticed that due to a typo it would have only worked for square input images; I've also fixed that.

    The fixes should be available in the 1.4-SNAPSHOT version of OpenIMAJ in an hour or two (you should just be able to edit the maven pom.xml file and update the openimajVersion property, and then tell eclipse to update the project [should be automatic if the pom file is edited within eclipse], otherwise, right-click on the project in the eclipse project explorer and go to Maven->Update project...)

     

Anonymous
Anonymous

Add attachments
Cancel