Ask Your Question

Human detector using HAAR cascades has too many false positives it is confident about

asked 2012-07-24 04:12:35 -0600

gerrit gravatar image

updated 2012-07-24 05:09:10 -0600


i am trying to train a HAAR-cascade to detect people. For this i generated positive samples from an recorded video by foreground-background-subtraction. I used pictures of the empty room with different arrangements and different lighting as negative samples. The trained cascade seems to detect a person with an acceptable rate. But the cascade also has a lot of false positives in regions that were not rearranged in the different negative samples. For example there is a table that could not be moved. The cascade is constantly marking the corner of the table although that table is in the negative samples and even is in EVERY negative sample. I tried different approaches to lower the false-alarm-rate but i was not very successfull. I tried to increase the number of stages to 35-40. At first that seemed to help but when i increased the number of samples using different people to get more variance the false positives reappeared. My guess is that the surrounding background in the positive samples is the cause for the false positives since the samples are from that room as well and for example parts of that table are in some samples. In another attempt i tried to decrease the size of the region i cut from the frame to get less background in my positive samples. But if i am right and the background in the samples is the reason then that lesser background might still be too much. Since from the foreground-background-subtraction i have the backgroundpixels i thought about replacing them with white noise in the positive samples. Could that help or would it be harmful? Does anybody have an alternativ solution how i can lower the false-positive-rate? I would be thankful for any assistance.


edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2012-07-25 02:24:28 -0600

Kirill Kornyakov gravatar image

It is known that Haar is not good for human body detection. You're right, you may have problems with number of both positive and negative samples (do you have thousands of unique images?), you may also have problems with how you cut positives, but the root cause should be that Haar features are not good for such task. And I suppose that LBP is not good as well.

You should better look into HOG direction, check this paper: Navneet Dalal and Bill Triggs, Histogram of oriented gradients for human detection. 2005. You can try to use the existing cascade: You can even try it on GPU with CUDA:

edit flag offensive delete link more


Hello, sorry for my late response and thank you for your answer. I knew that HAAR isn't ideal for human detection due to the variance in clothing but in my understanding it shouldn't hit where the region was clearly in the negative samples. The images i generate from the sample-videos are kind of unique. In the videos different people walk through the room. So the limbs have different configurations and the persons have different orientations in the room. But since i save every frame there are a lot of samples that are similar to each other because from one frame to the next the person just moved a little bit. I tried to use HOG as well and with it i have the same problem just less false positives. I now have tied to add noise to the background as i described above. I will report back...

gerrit gravatar imagegerrit ( 2012-07-31 08:00:08 -0600 )edit

... when the cascades have finished training and i can see whether that improves it. In the meantime perhaps you could answer another question that came to my mind. Should there be made some kind of preprocessing? I read that for face detection it helps to equalize the histogramm after converting to grayscale. So is there something that could help here? Is there somesthing you could preprocess when using HOG? Or should i insert this as a new question?

gerrit gravatar imagegerrit ( 2012-07-31 08:09:46 -0600 )edit

answered 2016-03-05 16:12:51 -0600

Pablo Aguado gravatar image

For me, the cascade included in OpenCV 2.4.9 was not doing very good, many false positives. This one is better trained and the results I'm getting are amazing. Note is LBP, not HAAR - I think it's also faster because of this.

edit flag offensive delete link more


Thanks Pablo! Our cascade outperform OpenCV standard ones :)


ComputerVisionary gravatar imageComputerVisionary ( 2020-03-29 06:16:33 -0600 )edit

Question Tools

1 follower


Asked: 2012-07-24 04:12:35 -0600

Seen: 13,213 times

Last updated: Jul 25 '12