-
-
Notifications
You must be signed in to change notification settings - Fork 55.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improved cat face cascades (lower false positive rate) #7097
Conversation
👍 nice update! |
@StevenPuttemans Thanks! I used your tips from OpenCV 3 Blueprints! |
Could you expand on what you did exactly? Is it an example of the hard negative mining? Would be nice to have an actual sample that proves it works decently! |
I haven't used hard negative mining (though I will keep it in mind for the next version). I used your advice about choosing the number of stages based on a reported acceptance ratio of close to 10^(-5). I also saw that you recommended a higher proportion of negative samples than I was using, so I added a lot more negative samples of generic indoor and outdoor scenes. Finally, on your advice, I lowered the minHitRate from 0.999 to 0.995. I ended up with the following inputs and parameters:
I will release the code for data acquisition, pre-processing, and training in another repo after the cascades are merged into OpenCV. |
Great work! Thanks for the explanation! |
thanks! 👍 |
excellent work!i want to know what is your training data? |
Thank you! The following script shows where I obtained the training data: https://github.com/JoeHowse/PRIVATE-OpenCV-4-for-Secret-Agents-Second-Edition/blob/master/Chapter003/cascade_training/download_datasets.sh For more information about the training, please refer to the rest of that repository, and to my upcoming book OpenCV 4 for Secret Agents, which will be available from Packt Publishing very soon. |
@JoeHowse Thanks |
This pullrequest changes
Re-trained the cat face cascades with more negative samples and more stages. False positives are much rarer now. If you tailored your code for the previous version of one of the cat face cascades, now you should re-adjust the arguments of CascadeClassifier::detectMultiScale. For example, decrease the value of the minNeighbors argument. You do not need to use a human face detector to cross-check the positives anymore.
haarcascade_frontalcatface_extended.xml has the lowest false positive rate but you should set its scaleFactor and minNeighbors relatively low to enhance its sensitivity. If you tweak the parameters carefully, you can probably get the most accurate results from this cascade but it is computationally relatively expensive.
haarcascade_frontalcatface.xml and lbpcascade_frontalcatface.xml are more sensitive but they need higher scaleFactor and minNeighbors values to keep the false positive rate low. lbpcascade_frontalcatface.xml is computationally cheapest.