How to train a cascade classifier for a a fixed image (logo)

asked 2015-05-10 15:25:31 -0600

Warren gravatar image

I have attempted to train a haar cascade classifier several times with varying, bad results. I created several positive sample images of a card with the logo printed on it. I added several block-like features to the card to make it easier to recognize. I downloaded a set of negative sample images. I generated vectors and samples with commands I pieced together from several websites, mainly this one: http://coding-robin.de/2013/07/22/tra... I am using OpenCV 3.0 rc1

I tried a range of stages, from 5 to 20. I have tried from 100 to 1500 positive samples and from 500 to 2000 negative samples. I have tried window sizes from 20x20 to 48x48 (the card I want to detect is square).

None of the cascade files have been any good. Some won't detect anything. Some detect almost everything... but not the card! I've checked over everything I can think of - like did I actually get the positive samples in the right directory...

I'm at a loss. Are there some common rookie mistakes I should double check? Has anyone had bad results like this? Are bad cascade files common? My target seems much easier to classify than most problems since it is a fixed image. Does that change the problem somehow in a way I do not grasp?

edit retag flag offensive close merge delete

Comments

What kind of features are you using? Could you please show one of your positive and negative samples?

LorenaGdL gravatar imageLorenaGdL ( 2015-05-11 03:32:30 -0600 )edit
1

If you have a single fixed image/logo, the why the hell would you apply cascade classifiers (who are specifically designed to model variance of an object class into a single model for detection). I would suggest investigating techniques like keypoint matching, template matching, ...

StevenPuttemans gravatar imageStevenPuttemans ( 2015-05-11 05:10:11 -0600 )edit

Positive and negative samples. The originals are four times larger. I downscaled for sharing. https://www.dropbox.com/s/5y1g88zrqff...https://www.dropbox.com/s/jiai7vo4yrk...

When you say "what kind of features?" Do you mean haar, hog, lbp? If so then I believe it's Haar. I didn't specify anywhere but the cascade file indicates haar in the xml.

Warren gravatar imageWarren ( 2015-05-11 08:01:55 -0600 )edit

I am interested in possibly using other methods, Steven. Thank you for the advice. I am currently investigating cascade classifiers because A. they are fast B. my initial test with bag-of-words/feature points gave poor results.

I am using Java on an Android device so SURF and SIFT are not available. Even if they were the patent would be an issue. I tried bag-of-words matching using ORB and a few other descriptors but I was getting a large number of matching points when the card wasn't visible followed by a very small (insignificant) increase in matching points when the card became visible.

I am also concerned that if I try to detect many possible templates at once the performance may become an issue with feature point matching.

That being said, I'm open to ideas :-)

Warren gravatar imageWarren ( 2015-05-11 08:08:59 -0600 )edit

Cascade classifiers fast? I can give you tons of examples where that isn't the case. Certainly not if you have a large image pyramid and many different scales.

StevenPuttemans gravatar imageStevenPuttemans ( 2015-05-11 09:05:01 -0600 )edit

From what I understand a cascade classifier should be fast for my problem. The problem is relatively simple and there are many commercial devices that use cascades on modest hardware. That is why I'm confused by my results. It seems I must be doing something wrong to have so many false positives and no correct identifications.

Warren gravatar imageWarren ( 2015-05-11 10:08:39 -0600 )edit