Ask Your Question
1

How to accelerate face detection time using HaarCascade

asked 2013-04-05 11:22:44 -0600

k1d gravatar image

Hi guys,

I'm using opencv tutorial to detect face and eyes. I'm using opencv242, VS2010, and Win 7 x64. When I run the code, the frame motion is really slowly. Even when I use method VideoCapture, it's make nothing. I think it's caused by Haar classifier. Is there anyone have solution how to accelerate detection time using HaarCascade?

Regards,

Andrew

edit retag flag offensive close merge delete

Comments

sammy gravatar imagesammy ( 2013-04-05 11:50:40 -0600 )edit

Yup. I've checked that link. Thanks a lot. I've tried to resize frame into smaller size (320 x 192). The frame motion is faster, but it seems difficult to detect eyes. When the frame size is big (400 x 300) it can detect but slowly frame motion. Do you have any idea how to make detection is small frame using haarcascade?

k1d gravatar imagek1d ( 2013-04-05 20:16:07 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
4

answered 2013-04-05 14:07:46 -0600

Basically there are several ways of going faster

  1. Aplly GPU detection if you have large images (the time for sending data to GPU needs to be sufficiently small compared to the CPU processing time, which is not the case for single small images)
  2. Reduce the size of your input image if the faces are much larger than 24x24 pixels.
  3. Apply LBP features, which are no floating point operations like Haar wavelets.

Another question: do you perform the eye detection only on possible face regions? This will also reduce calculation time alot. Furthermore, the more positive detections there are in an image, the longer the processing will actually take, because those regions will go deeper in the cascade.

edit flag offensive delete link more

Comments

1

Thank you,Steven.

I've reduce the frame size, but the smaller it takes, the more difficult to detect. Do you have any idea how to improve it? For face detection I'm using LBP face detection, but there are no classifier for eye detection. I detect face first, and get faceROI, from faceROI then I detect eyes.

k1d gravatar imagek1d ( 2013-04-09 22:18:39 -0600 )edit

What you could do is downscale the frame, but upscale your frame windows before processing. It will then again find more detections, but again detection time will rise. It is always a tradeoff between both. But try the GPU implementation please, it goes extremely well. Doing a 35 frame per sec face detector on webcam feed with LBP. Remember that applying the eye detector to the roi, is again a factor that slows down :)

StevenPuttemans gravatar imageStevenPuttemans ( 2013-04-10 01:18:08 -0600 )edit

@StevenPuttemans do you have any idea, what face detection method for video-based application is suitable for real-time purpose? By reducing image size will not help in many applications which require details.

Aj-611 gravatar imageAj-611 ( 2016-01-27 21:10:37 -0600 )edit

If you know your setup, achieving real time detection with the LBP model is quite straightforward. Play with the minSize and maxSize parameters. Furthermore if it is a frontal face camera, you could reduce the scale parameter to achieve faster detection.

StevenPuttemans gravatar imageStevenPuttemans ( 2016-01-28 03:36:43 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2013-04-05 11:22:44 -0600

Seen: 5,716 times

Last updated: Apr 05 '13