A Haar classifier for trees in satellite image: how to generate positive samples?

asked 2016-12-02 13:18:51 -0500

updated 2016-12-03 04:25:47 -0500

Hello everyone.

I'm trying to train a Haar classifier for detecting trees in satellite images. While it's almost easy to generate negative samples (it's sufficient to cut parts containing streets or buildings without any tree), I find it difficult to generate positive samples.

I've read (in this forum, too) that I should crop positive sample containing only desired object (a tree, in my case); anyway, it's hard to obtain this result with satellite images since:

  • images are downloaded from Bing with different levels of zoom, thus cutting trees produces samples with different sizes
  • because of the fact satellite images include aerial landscapes of cities, when I cut a tree it's not possible to isolate it from background containing pieces of strees or parts of other trees (this happens when there's an agglomerate of trees, as in parks or small green areas).

I've tried to generate a certain number of random square samples from satellite image. I've chosen size of squares in order to contain, in average, a tree almost completely. Then, I parsed samples one by one, separating them in negative and positive sets. I've stated that a sample is positive if it contains at least a tree at 70% of its surface, by visual inspection. Anyway, detection results are awful.

My questions are;

  • can I skip the request of having positives sample with same ratio?
  • how can I generate, correctly, positive samples to train classifier correctly to detect trees?

I even tried to browse web to look for a dataset of trees extracted from satellite images, but I haven't found anyone. Can you suggest one?

Thanks for support.

EDIT: Here are some examples of positive samples (80x80 pixels) I've used

image description image description image description

edit retag flag offensive close merge delete


it would be helpful, to see one of your positive images

berak gravatar imageberak ( 2016-12-03 00:36:08 -0500 )edit

yes, sure. I've edited post adding three examples of positive samples: 1. a tree completely contained in square 2. a tree comprised in an agglomerate 3. a tree completely contained in square, with pieces of roofs and streets

biagio montesano gravatar imagebiagio montesano ( 2016-12-03 04:28:33 -0500 )edit

this is not an answer, but i don't think, that will ever fly.

your images contain far too much "inner-class-variance", and if there are features, they are not in the same place / orientation.

first thing to try might be: instead of (badly !) cropping your images, like you do it now, rather don't change anything on your satelite images, and use the annotation tool, to generate a list of (tightly bound)rectangles, the create_samples tool will care for cropping/resizing on its own later

but again, imho, chances are very low, to get something nice from the haar/lbp training here, your trees are just far too random for that.

berak gravatar imageberak ( 2016-12-03 04:47:36 -0500 )edit

thanks for your answer. actually, the images I included in post are not the output of any cropping operation. they are just two samples that I labelled as positive, since they contain a tree for the greatest part of its surface in image.

what worries me is the greatest variance across trees' shapes: just considering Rome's case, you can encounter maritime pines, cypresses (which appear as small spots when seen from above), oaks... do you agree with me in saying that this variance could be a problem?

would you propose any other path to a tree detector, apart from Haar classifier?


biagio montesano gravatar imagebiagio montesano ( 2016-12-03 05:02:06 -0500 )edit

btw, just curious, how do you obtain those images ?

berak gravatar imageberak ( 2016-12-03 05:11:10 -0500 )edit

I have two problems:

  • no dataset available
  • I need an automatic procedure to extract samples (positive or negative) from an image just downloaded from Bing

thus, I take every image and generate 80 samples (in average) by moving a fixed window along image itself. Finally, I label each window as positive or negative.

biagio montesano gravatar imagebiagio montesano ( 2016-12-03 05:18:41 -0500 )edit