1
$\begingroup$

I'm currently collating images to try and develop a HAAR classifier using the OpenCV traincascade functionality. The objects I want to detect are small and numerous (bees), and I'm curious as to whether it would be better to train the image with lots of small cutouts of the bees as positive images, or to use bigger positive images with the bees present along with a chunk of the background.

$\endgroup$
1
$\begingroup$

You probably want to train on as tightly cropped rectangular region around the bee as possible.

I'm not sure if you already thought of this but you should remember that this classifier can only handle recognizing objects in rectangles whose axes are aligned with image, i.e. no rotated rectangles. This is going to be tricky if the bees can be facing any which way. A human face detector has the advantage that faces are almost always found right side up in the image. If you wanted to recognize upside down faces too you would probably train only on right side up images and then check your input image twice--once with the original input and once with it flipped upside down.

You probably want to do something similar for the bees. All of your training images should be aligned so that the bee has approximately same orientation and scale. Then if you want to detect different orientations you can rotate your input image.

$\endgroup$
  • $\begingroup$ What would happen if I used lots of images of bees in different poses, facing different directions etc whilst training my classifier? I'd read how Haar features was sensitive to rotation so was hoping if I trained the classifier using bees facing every direction I could get around this. $\endgroup$ – Jack Simpson May 6 '14 at 5:23
  • $\begingroup$ For this type of classifier you're making the job a lot harder. The way the training works is it selects haar regions and thresholds that would work for all of the training images. This means that the same relative positions of light and dark regions on the image have to hold even if the bee is rotated, which is obviously harder to find. This is just a heuristic but you might want to check to see what your average training image looks like. If it looks like a bee you're in good shape. If it looks like an indistinguishable blur then it's going to be tough. $\endgroup$ – Aaron May 6 '14 at 6:58
  • $\begingroup$ Another note: this is the same reason that opencv has a default face detector for frontal faces and another one for profile faces. A single classifier would not be good at capturing both types of faces. $\endgroup$ – Aaron May 6 '14 at 6:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.