jit.cv.faces help

drifting's icon

I am trying to use cv.jit.faces to track human faces. I was wondering how reliable this object is. When my face is close to the camera (for example, only my face is shown), the result is pretty accurate but as soon as I moved further back from the camera (part of my upper body is show), cv.jit.faces recognized some features on my coat as faces.
Is there anyway to improve it?
Some times, the faces counts jumps from 1 to 0 frequently. This is very annoying. All I wanted to do is that when there is people standing FRONTALLY, cv.jit.faces recognizes the faces and turn on the jit.qt.record. Is there any other way to do this other than cv.jit.faces?
Thanks a lot.

daanbr's icon

do you want to record just the faces?

Jean-Marc Pelletier's icon

Hi,

The algorithm used by cv.jit.faces is more or less state of the art even today. Of course, that doesn't mean it's always right! However, I doubt you'll be able to find something that works better, it's just that finding "faces" is actually very hard.

Yes, sometimes, the object finds "faces" in weird places, but usually, if you look at those areas and squint, you'll be able to see where the "face" is. For instance, it often mistakes my neck for a face. You'd think that a neck and a face would look very different, but if I manage to forget that it's a "neck" it's easy to see that my adam's apple looks almost exactly like a nose, and the shadow of my chin like eyes.

There's not much you can do about false positives like this, except try to train your own model but that's actually also very hard. Hey, even humans get fooled all the time – see the virgin mary on a toast. What I found works well for my in situations like yours, is to either only select the biggest face, or reject faces that are too small, or in places where you know faces aren't likely to appear. Real faces also tend to be more stable, so you can also decide to only select a face if it shows up in 3 or more consecutive frames, for instance.

If you want to stop recording when there are no faces, you can greatly improve stability by formulating your condition as "if there have been no faces in the last 30 frames" instead of "if there are no faces in the last frame".

The smallest faces the object can find is 20 by 20 pixels. Adjusting the input resolution might help improve accuracy and performance.

Anyway, hope this helps.

Jean-Marc

drifting's icon

thanks for your suggestions Jean-Marc. So setting up a delay would help. For example, I will set up the delay for 3 seconds. If during the 3 seconds, the data (recognized faces are stable), then it triggers the camera. When I try to turn of the camera, do the same
How to set up the delay of data? anyone knows?

ElectronicElement's icon

Hi I am using cv.jit.faces in a project. I am using it as a on/off toggle, what I have done so far is, I connected the output of cv.jit.faces to jit.pack then to jit.unpack to get just one of the streams, then I am using greater than [ >0 ] to start the other part of the patch and I faced the same problem when cv.jit.faces lose and track the face it restarts the whole patch. I combined a gswitch2 with a couple of buttons, and succeeded to make it just to output the first bang. But now I think that I would like to use that what you are talking about for another part of the patch when there is no faces but I don`t know how to do it. Any fast help will be greatly appreciated because I need to present my project at Uni next Monday.

"If you want to stop recording when there are no faces, you can greatly improve stability by formulating your condition as "if there have been no faces in the last 30 frames" instead of "if there are no faces in the last frame"."

ElectronicElement's icon

No bothers, I did it with set of select and greater than objects and I`ve got the desirable result.