Pregunta

Me compilado e instalado OpenCV (última versión del SVN) en Mac OS X (esto es tal vez el origen del problema).

Las obras de la muestra, pero el Detección de la cara algoritmo parece lento para mí. El tiempo de detección para una cara es de alrededor de 400ms (acabo de utilizar el ejemplo incluido). El FPS es entonces bastante bajo.

En youtube y todo, ver video súper suave con en tiempo real detección de rostros (incluso en el iPhone) así que me siento confunden. Recuerdo que es aún más rápido en mi viejo PC con Windows.

es de 400 ms un tiempo de detección correcta?

Nota: mi MacBook no es viejo (2009) y todo funciona muy bien en ella. Yo uso la cámara web iSight (cámara web integrada). Tengo sólo una cara (la cara) en la webcam. Y es casi al mismo tiempo si no hay una cara.

¿Fue útil?

Solución

What is the size of the input image. I am guessing 640x480. Generally people who post YouTube videos resize the image to 160x120. IN full resolution of 640x480 it is very difficult to get more than 2-3 fps. Try to send 160x120 image. You should be getting at least 10fps.

Otros consejos

Adding to the previous answers:

you can also speed things up by setting the Max and most importantly the Min size for detectMultiScale.

[Also, as the previous answers say, heavy scaling-down is in order as Haar detector uses very simple features (for the relations of upto 6 pixels; on larger scales you add up rectangle-like areas as if it was just one pixel). On standard mac/mbp2011 I could get around 60fps that is more than enough.]

For an even better speedup you could also eliminate non-changing areas, using say templateMatching.

Recently I had found a Simd Library, which has an implementation of HAAR and LBP cascade classifiers. It can use standard HAAR and LBP casscades from OpenCV. This implementation has SIMD optimizations with using of SSE4.1, AVX2 and NEON(ARM), so it works in 2-3 times faster then original OpenCV implementation.

I was having the same problem, on a Quad Core machine with 4GB RAM was 500ms per detection, however I've noticed there is a Scale option....getting this to:

./facedetect --scale=4

I get detection rates of <20ms

Hope that helps,

Keukpa

When running on image, you should downscale to certain limits. In case of videos, along with Face detection, you can also try tracking. You can do face detection every alternate frames and track the position of face in between frames.

Also, OpenCv supports use of Canny to discard regions where chances of finding Face is none.

Does anybody know why face detection in OpenCV 3.4.5 is so slow? I think it was a lot faster in version 3.4.3 I have not done any benchmarking but it seemed a lot faster.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top