Ask Your Question
0

Run the official face-detection sample and find the problem

asked 2018-08-16 05:11:46 -0600

rainY gravatar image

System information (version)

OpenCV => 3.4

Operating System / Platform => Android

Compiler => cmake

Detailed description

Run the official face-detection sample and find that the value detected by the face is incorrect. It is clear that the current screen has no face, but the detected rectangular frame is still displayed.

code segment

 mJavaDetector.detectMultiScale(mGray, faces, 1.1, 2, 2, // TODO: objdetect.CV_HAAR_SCALE_IMAGE
                new Size(mAbsoluteFaceSize, mAbsoluteFaceSize), new Size());
  Rect[] facesArray = faces.toArray();
for (int i = 0; i < facesArray.length; i++)
    Imgproc.rectangle(mRgba, facesArray[i].tl(), facesArray[i].br(), FACE_RECT_COLOR, 3);
edit retag flag offensive close merge delete

Comments

used haarcascade_frontalface_default

rainY gravatar imagerainY ( 2018-08-16 05:12:14 -0600 )edit

2 answers

Sort by ยป oldest newest most voted
0

answered 2018-08-16 07:34:37 -0600

berak gravatar image

updated 2018-08-16 08:56:54 -0600

there will always be false detections. what did you expect ?

you could increase the minNeighbours param (to say,3, 4 or 5), until you start losing valid detections

edit flag offensive delete link more

Comments

Are we talking about false positives on detection (not recognition) ? If that's the case - the model used is not trained well enough i am afraid - only my opinion.

If it would be my own model i would use hard negative mining to further improve the model. Just my 2 cents.

holger gravatar imageholger ( 2018-08-16 09:04:02 -0600 )edit

@berak minNeighbours I have already set it up, but there is still a problem

rainY gravatar imagerainY ( 2018-08-16 21:49:19 -0600 )edit

@berak I don't understand what you mean.

rainY gravatar imagerainY ( 2018-08-16 21:51:03 -0600 )edit

@berak My problem is that the current frame has no face, but it detects the "face"

rainY gravatar imagerainY ( 2018-08-16 22:02:15 -0600 )edit

And if you really want a robust solution, go for a YOLOv2 detector, based on the same data. Will beat the cascades every single time.

StevenPuttemans gravatar imageStevenPuttemans ( 2018-08-17 06:58:25 -0600 )edit
2

answered 2018-08-17 06:57:21 -0600

if you really want to stick with the cascades, at least use the frontalface_improved_lbp one, which has several rounds of hard negative mining and is thus way more robust than the out of the box haarcascade model. As stated by everyone, you will always have false detections (face rectangles where there is no face). Those are almost completely gone in the improved model. How we got there can be read here.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2018-08-16 05:11:46 -0600

Seen: 123 times

Last updated: Aug 16 '18