Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Detections too small with OpenCV Cascade classifier

Goal

I am trying to detect roofs in aerial images using Viola and Jones implementation provided by OpenCV. I have trained classifier with the following parameters:

opencv_traincascade -vec roof_samples.vec -bg bg.txt -numStages 20
-minHitRate 0.99999 -numPos 393 -numNeg 700 -w 50 -h 25

The problem

Roofs are being recognized, but if the roof is large, the detection windows is drawn around a part of the roof rather than around the entire roof. The image shows detections in red, green and blue. Green corresponds to the ground truth - notice how the green rectangle covers the whole roof, whereas all other rectangles do not.

Detections are in red, blue, white. Green is ground truth.

What I have tried

  • I tried altering the scale parameter, but it didn't help
  • I also modified -w and -h, but I don't expect that to help either (I increased them and the training phase is currently running, but as expected, it is extremely slowly). I really don't expect things to get better with this change though.

Question:

I'm wondering if anyone knows which parameters I can modify to ensure larger roofs are detected as a single roof rather than being detected in small patches.

Detections too small with OpenCV Cascade classifier

Goal

I am trying to detect roofs in aerial images using Viola and Jones implementation provided by OpenCV. I have trained classifier with the following parameters:

opencv_traincascade -vec roof_samples.vec -bg bg.txt -numStages 20
-minHitRate 0.99999 -numPos 393 -numNeg 700 -w 50 25 -h 25

The problem

Roofs are being recognized, but if the roof is large, the detection windows is drawn around a part of the roof rather than around the entire roof. The image shows detections in red, green and blue. Green corresponds to the ground truth - notice how the green rectangle covers the whole roof, whereas all other rectangles do not.

Detections are in red, blue, white. Green is ground truth.

Training images:

Below are 3 examples of training images I have used:

Training_1Training_3image description

What I have tried

  • I tried altering the scale parameter, but it didn't help
  • I also modified -w and -h, but I don't expect that to help either (I increased them and the training phase is currently running, but as expected, it is extremely slowly). I really don't expect things to get better with this change though.

Question:

I'm wondering if anyone knows which parameters I can modify to ensure larger roofs are detected as a single roof rather than being detected in small patches.