Haar cascade detector with non-maxima suppression

asked 2020-09-16 09:52:00 -0500

LauLauThom gravatar image

Dear all,
I know the Haar-cascade detectors are kind of old-fashioned and that it's challenging to train a cascade with good detection capacities.
I still like it though because you can train on CPU rapidly for simple stuff and it runs everywhere with opencv.

I just want to share a small contribution of mine, in which I used Non-Maxima Suppression (cv2.dnn.NMSBoxes) to filter the detections after the cascade.
I found that the previous parameter to remove redundant detections (min_neighbor) was not very efficient, while the classical overlap-based non-maxima suppression works quite well.

I released a small python package with an example jupyter notebook at

It's also available via pip pip install haar-cascade-nms

I just leave it here in case someone has ever the motivation to translate that to a novel cascade.detectMultiScale4 function signature (eventhough I doubt this would ever happen ><)
Contributing C/C++ code is beyond my skills...

edit retag flag offensive close merge delete