arunponnusamy / cvlib

A simple, high level, easy to use, open source Computer Vision library for Python.
http://arunponnusamy.com/cvlib/
MIT License
647 stars 127 forks source link

Improve performance by limiting the detecting to one face #6

Open ModarD opened 5 years ago

ModarD commented 5 years ago

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

arunponnusamy commented 5 years ago

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.