Simple logo haar file I created causes tons of false positives.

asked 2018-09-26 13:09:17 -0600

So I took the facedetect.py and made a custom haar file to detect a simple logo. For the sake of simplicity it's something like the gap logo on the left here: http://adweek.blogs.com/.a/6a00d8341c...

I cropped an image to the exact bounds of the logo (the blue box on the left) and generated samples from it:

opencv_createsamples -img gaplogo.png -num 1000 -vec hb.vec #(it actually wouldn't let me do more than 1000)

Then I downloaded 2600 random images. Just everything under the sun. Buildings, people, desktop images (I tried this just because it's just randomly triggering on the desktop), landscapes, plants. You name it, I downloaded it. From what I read it's just supposed to be images that do not contain thing.

Then I build my haar file

opencv_traincascade -data data -vec hb.vec -bg neg.txt -numPos 999 -numNeg 2500 -numStages 10

It actually only makes it through like 3 stages before it declares that's it and generates the haar file.

In stead of a webcam, I feed in a stream of my desktop and it tries to draw boxes on nothing. Ideally, when I bring up the logo, and only the logo, it should draw a box around it. Instead it spazes out on random stuff. I thought something simple like the logo should have been a slam dunk for easy identification.

edit retag flag offensive close merge delete

Comments

anyone who tried the "simple" way here, simply failed. (it's a flawed idea)

no, you can't train cascades successfully with a single positive image. also bad, if your background images don't represent your actual background.

berak gravatar imageberak ( 2018-09-27 00:11:51 -0600 )edit