I have ran an Object based RF on google earth engine, I managed to get the accuracies ranging between 63 and 68% for my wetland. The problem now is that my classes wont visualize, even when I exported the raster file to ArcGIS, it comes out empty. Any Idea on how I can sole this problem. See the scripts that I ran for my classifications below:

Map.setCenter(28.41025042440488,-24.049672729123795);

//Filtering of sentinel 2 images

var Spatialfiltered = Sent2. filterBounds(Lindani);

var temporalfiltered = Spatialfiltered.filterDate("2016-01-01", "2020-12-31");

print("temporalfiltered",temporalfiltered);

//Sorting of based on least cloud cover

var sorted = temporalfiltered. sort("CLOUD_COVER");

var first = sorted. first();

// Clipping the stack of sentinel-2 images

var table_bounds = function(image) {

// Crop by table extension

return image.clip(ROI);

};

var Clipped = temporalfiltered.map(table_bounds);

print(Clipped);

Map.addLayer(Clipped);

var sorted = Clipped. sort("CLOUD_COVER");

var first = sorted. first();

Map.addLayer (first,{}, "default RGB");

var visparameters = {bands:["B4","B3","B2"], max: 0.3};

Map.addLayer(Clipped,visparameters,"true-colour composites");

//Calculating median values for the clipped area

var median= Clipped.select(["B2","B3",

"B4","B5","B6", "B7","B8","B11","B12",]). median();

Map.addLayer(median, visparameters, "new_median");

print("median");

//Calculating NDVI from median composite

var nir = median. select("B8");

var red = median. select("B4");

var NDVI = nir.subtract(red).divide(nir.add(red)).rename("NDVI");

var NDVIParams = {min: 0, max: 0.7, palette: ["Blue","Brown","Green"]};

Map.addLayer(NDVI, NDVIParams, 'NDVI image');

//Calculating NDWI from median composites using NIR and Green bands as discussed by mcfeeters et al1994

var green = median. select("B3");

var NDWI = green.subtract(nir). divide(green.add(nir)).rename("NDWI");

var NDWIvisparams = {min:0.5 , max:1, palette:["00FFFF", "0000FF"]};

Map.addLayer(NDWI, NDWIvisparams, "NDWI_image");

//Calculating soil adjusted vegitation index from sentinel-2 data

var msavi2 = nir.multiply(2).add(1)

.subtract(nir.multiply(2).add(1).pow(2)

.subtract(nir.subtract(red).multiply(8)).sqrt()

).divide(2).rename("msavi2");

var MSAVIvisparams = {min:0.0, max:1, palette:[

'FFFFFF', 'CE7E45', 'DF923D', 'F1B555', 'FCD163', '99B718', '74A901',

'66A000', '529400', '3E8601', '207401', '056201', '004C00', '023B01',

'012E01', '011D01', '011301'

]};

Map.addLayer(msavi2, MSAVIvisparams,"MSAVI");

print(NDVI);

var data = median.addBands(NDVI).addBands(NDWI).addBands(msavi2);

//Creating seed grinds

var seeds = ee.Algorithms.Image.Segmentation.seedGrid(36,"square");

print(seeds);

// Running the SNIC model to segment the image

var snic = ee.Algorithms.Image.Segmentation.SNIC({

image: data,

size: 32,

compactness: 5,

connectivity: 8,

neighborhoodSize:64,

seeds: seeds

}).select(["B8_mean", "B4_mean","B3_mean","B2_mean","NDVI_mean","msavi2_mean","NDWI_mean","clusters"]);

print(snic);

var clusters = snic.select("clusters");

Map.addLayer(clusters.randomVisualizer(), {}, "clusters");

print(clusters);

var New_data = data.addBands(clusters);

print(New_data);

//Computing per-cluster Stdev

var Stdev = New_data.reduceConnectedComponents(ee.Reducer.stdDev(),"clusters", 64);

print(Stdev);

Map.addLayer(Stdev, {min:0, max:0.8}, "StdDev", false);

//Computing per cluster Areas, Perimeters, Width, Height

var Area = ee.Image.pixelArea().addBands(clusters).reduceConnectedComponents(ee.Reducer.sum(), "clusters", 64);

Map.addLayer(Area, {min:0, max: 5000}, 'Cluster Area', false);

var minMax = clusters.reduceNeighborhood(ee.Reducer.minMax(), ee.Kernel.square(1));

var perimeterPixels = minMax.select(0).neq(minMax.select(1)).rename('perimeter');

Map.addLayer(perimeterPixels, {min: 0, max: 1}, 'perimeterPixels');

var perimeter = perimeterPixels.addBands(clusters)

.reduceConnectedComponents(ee.Reducer.sum(), 'clusters', 64);

Map.addLayer(perimeter, {min: 100, max: 400}, 'Perimeter size', false);

var sizes = ee.Image.pixelLonLat().addBands(clusters).reduceConnectedComponents(ee.Reducer.minMax(), 'clusters', 64);

var width = sizes.select('longitude_max').subtract(sizes.select('longitude_min')).rename('width');

var height = sizes.select('latitude_max').subtract(sizes.select('latitude_min')).rename('height');

Map.addLayer(width, {min:0, max:0.02}, 'Cluster width', false);

Map.addLayer(height, {min:0, max:0.02}, 'Cluster height', false);

//Creating object properties for OBIA classifications

var objectPropertiesImage = ee.Image.cat([

snic.select("B8_mean","B4_mean","B3_mean","B2_mean","NDVI_mean","msavi2_mean","NDWI_mean"),

Stdev,

Area,

perimeter,

width,

height

]).float();

var features2 = [

ee.Feature(Table1geo, {"class":1}),

ee.Feature(Table7geo, {"class":2}),

ee.Feature(Table8geo,{"class":3}),

ee.Feature(Table9geo,{"class": 4})];

var TrainingD = ee.FeatureCollection(features2);

var bands = ["B8_mean","B4_mean","B3_mean","B2_mean","NDVI_mean","msavi2_mean","NDWI_mean"]

//Training the Classifier (Random forest)

var training = snic.select(bands).sampleRegions({

collection: TrainingD,

properties: ['class'],

geometries: true,

scale: 10

});

var classifier = ee.Classifier.smileRandomForest(10).train({features: training,

classProperty: 'class',

inputProperties: bands

});

//Classification using Radom forest

var classification_RF = objectPropertiesImage.classify(classifier);

Similar questions and discussions