I am classifying rice for the Red River Delta with 2 class: class 0: Rice class 1: Not rice
I used svm classifier algorithm. However, after running the code, the classifier operated for a long time without results. Here is my code : Link: https://code.earthengine.google.com/f70f6ae7d54a428829a84cbc9d27ea3b
Code:
//Load 1 shapefile red river delta
var dbsh_shape = ee.FeatureCollection('users/chungpd/DBSH_Shape');
Map.centerObject(dbsh_shape);
Map.addLayer(dbsh_shape);
// Use these bands for prediction.
var bands = ['VV', 'VH'];
// Load an imagecollection over a portion of Red river delta
var img1 = ee.ImageCollection('COPERNICUS/S1_GRD')
.filterDate('2017-01-03', '2017-01-18')
.filterBounds(dbsh_shape);
// Cut img1 according to "dbsh_shape" shapefile
var img2 = img1.map(function(image) {return image.clip(dbsh_shape);});
// Mosaic img2
var image = img2.mosaic();
print (image);
// Load training polygons from a Fusion Table.
// The 'class' property stores known class labels.
var polygons = ee.FeatureCollection('ft:1fxOJdG56CUWXy7MWi4KPeCAvKYC4YHFzMbRPU7S3');
// Get the values for all pixels in each polygon in the training.
var training = image.sampleRegions({
// Get the sample from the polygons FeatureCollection.
collection: polygons,
// Keep this list of properties from the polygons.
properties: ['class'],
// Set the scale to get Landsat pixels in the polygons.
scale: 10
});
// Create an SVM classifier with custom parameters.
var classifier = ee.Classifier.svm({
kernelType: 'RBF',
gamma: 0.5,
cost: 10
});
// Train the classifier.
var trained = classifier.train(training, 'class', bands);
// Classify the image.
var classified = image.classify(trained);
// Create a palette to display the classes.
var palette =['00FF00', 'DD0000'];
// Display the classification result and the input image.
//Map.addLayer(image, {bands: ['VV', 'VH'], max: 0.5, gamma: 2});
//Map.addLayer(classified, {min: 0, max: 10, palette: palette}, 'Isrice');
Map.setCenter(105.96999, 20.90339, 7);
//Map.centerObject(image, 10);
Map.addLayer(image, {bands: ['VV', 'VH'], max: 0.4}, 'image');
Map.addLayer(classified, {min: 0, max: 1, palette: ['00FF00', 'DD0000']},
'classification');
This is the error:
classification error: Layer error: Computation timed out.
dbsh_shape
.