Ask Your Question

Checking if face/body was already there

asked 2018-08-27 21:49:54 -0500

Taarak gravatar image


I am building a application where it need to check for faces, and work on it if they are after a point on the screen. Up to there it works, but processing the face at every frame, what reduces FPS from 20 to 2 in some seconds. So, how does I can know if a detected face was already there? And if it was processed before (check if it already crossed the desired point). I tried using arrays to store the previous position of the faces, but didn't worked well, since it was index based, what completely ends up everything if there are more than 1 face. To try predict if the face being detected is the same as before, I tried a position prediction algorithm, that didn't worked well with multiple faces. It worked picking all previous positions of what the applications think is the same face, takes the average of the values and pick the nearest face, into a range, of the predicted point. Just by reading I think you could notice that if the predicted face moves to the other way, and there is someone at the place the algorithm predicted, it thinks that it is the same face.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2018-08-28 06:14:19 -0500

holger gravatar image

updated 2018-08-28 06:16:46 -0500


Lets take some steps back . You wrote " Up to there it works, but processing the face at every frame, what reduces FPS from 20 to 2 in some seconds" ...

So you face detection will not be in real time. I would work on the detection performance of the face. For example you could run a cnn model on gpu to detect the face. With that you should be able to detect in real time.

OpenCV let you detect face via a cnn model(performance is around 38 ms on cpu). Check this:

The other solution would be to use the tracking api. Basically you detect the object once in a frame and detect it in subsequent frames via the tracking api. But once again - this could be expensive(i dont have times for the tracking api yet) too and maybe wont solve your problem(false positive detection, etc..).

So i would recommend you to work on making the face detection perform in real time.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-08-27 21:49:54 -0500

Seen: 69 times

Last updated: Aug 28 '18