2

I am doing land use classification in Google Earth Engine. I am using three different classes(forest, building, water) for classification. For each class, there is a shapefile containing polygon geometries of various sizes.

Training_shapefile contains 50 polygons for each class and polygons are of various sizes.

I want to know:

  1. Does sampleRegions function uses all pixels values in polygons? Or is it calculating mean value (or some other normalization) for each polygon.

  2. In other words, if I am applying Random forest classifier, does input for classifier contains 50 values for each class (because of 50 polygons of each class) or the input size depends on total no of pixels (no of pixels in each polygon of a given class * no of polygons in each class).

Code used is given below. Code is working fine and I am able to do the classification. But I am not sure about the size of my training input for the random forest classifier as asked above.

//training_shapefile contains 50 polygons for each class and polygons are of various sizes.

var training_fc = ee.FeatureCollection('users/ha/training_shapefile')



var training = training_image.sampleRegions({
  collection: training_fc,
  properties: ['class'],
  scale: 10
});

// training the random forest classifier
var trained = ee.Classifier.randomForest(10).train(training, 'class', bands);

1 Answer 1

0

I figured it out by comparing the results of different images (known pixel values).

sampleRegions function returns all pixels values in a given polygon.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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