arunponnusamy/cvlib

Improve performance by limiting the detecting to one face

Opened this issue · 1 comments

Hello @arunponnusamy , Thank you for the great lib, I wonder if limiting the dnn output to one face would make the detection a bit faster?
Detection time is ~0.3 on my core i5 460M @2.53GHz
Any tips for boosting the detection time?

Thanks

Hello @ModarD , detect_face function actually applies SSD object detection model on the input image. It will detect all the occurrences of the object (in this case face). I am not sure if we can limit the detection to one. We can choose not to process the detection further (avoiding drawing rectangles etc).

If you are looking for a lighter face detection method, you can use haarcascades. But again they work mostly for frontal faces and the accuracy can be low. If you are using pre-compiled opencv-python package, I would suggest to compile opencv from source with optimizations enabled for your platform (OpenCL, SSE, Intel Math Kernel etc) also take a look at the different backends / targets available in DNN module.