Ask Your Question

Improving Haar Cascade results

asked 2020-08-26 20:14:07 -0500

tym gravatar image

Hey everyone,

Second attempt at making a Haar Cascade; initial one I just followed a frontal face tutorial and it worked out pretty good. This time I've tried using Cascade Trainer GUI by amin-ahmadi, with CV2 version 4.1.2 installed, to try train a cascade for foxes.

Using ImageNet, I gathered 1,851 positives (of foxes, vulpus vulpus) and 2,796 negatives (trees, cliffs, plants). Used 15 stages, sample width and height of 24, and feature type HAAR. Training roughly took ~6 hours.

Results were interesting:

image description

The only cascading part of my classifier was the cascading boxes detecting the floor.

What could I have done better, any stand out mistakes? I read that maybe I should have cropped the photos and sized positive photos to similar dimensions?

Happy to use python and a server in the future rather than a GUI. Would love to just get some rudimentary fox detection working.

Thanks in advance!

Edit: Putting some more images through it - it seems to detect foxes not too badly; the issue is it does think general background objects are foxes too, like in the photo above.

edit retag flag offensive close merge delete


Switch to deep learning. Better accuracy, better robustness.

Eduardo gravatar imageEduardo ( 2020-08-27 08:58:20 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2020-08-28 09:39:40 -0500

Eduardo gravatar image

updated 2020-08-28 09:51:22 -0500

To add more info about why you should not use Haar cascade classifiers:

  • obsolete method
  • no viewpoint robustness, try detecting faces with the OpenCV faces Haar files: slight rotation and it will not detect, slight profile face and it will not detect also, ...
  • long training time, especially with Haar
  • no ratio robustness (ratio of the bounding box)
  • crappy detection performance, impossible to get good detection accuracy without huge number of samples and without good experience

Deep learing:

  • de facto standard nowadays
  • lots of tools
  • have a look at tiny-YOLO, SqueezeNet, etc. for lightweight networks for embedded platforms
edit flag offensive delete link more


After a lot of reading, I think you're right and I agree. I'm going to go ahead and try train a YOLOv3 model to detect foxes instead, and hopefully find some embedded hardware that can run tiny-YOLO well enough. Thanks for your help! Any tips before I start training?

tym gravatar imagetym ( 2020-08-29 06:09:13 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2020-08-26 19:37:32 -0500

Seen: 41 times

Last updated: Aug 26