1

I am trying to redo this tutorial: https://developers.google.com/earth-engine/classification, using the MaxEnt classifier with my data.

Code: https://code.earthengine.google.com/0ce8a254cd46d7b8d0384d9fdd2d1675

//*******************************************************************************************
// Set Study Area
var countries = ['HU', 'BU', 'IT', 'LO', 'AU', 'EZ'];
var geometry = ee.FeatureCollection('USDOS/LSIB/2013').filter(ee.Filter.inList('cc', countries));
Map.addLayer(geometry.draw({color: 'ffffff', strokeWidth: 3}), {},'Study Area');
Map.centerObject(geometry, 5);

//*******************************************************************************************
// Import Data

var points = ee.FeatureCollection("users/farhatlokmen/ecoModeling/falcoCherrug");
var current245 = ee.Image("users/farhatlokmen/ecoModeling/current245").clip(geometry);

//*******************************************************************************************
// MaxEnt

var bands = ['b1', 'b5', 'b6', 'b12', 'b13', 'b14'];
var label = 'SPECIESCODE';

// Sampling
var sampleData = current245.select(bands).sampleRegions({
  collection: points,
  properties: [label],
  scale: 500
});

// Build a classifier
var classifier = ee.Classifier.gmoMaxEnt(0,  0.00001, 0.00001, 0, 50)
                            .setOutputMode('PROBABILITY')
                            .train(sampleData, label, bands); // training

// Classify the image with the same bands used for training.
var classified = current245.select(bands).classify(classifier);

// Display the inputs and the results.
Map.addLayer(classified, {min: 0, max: 1, palette: ['black', 'red']}, 'classification');

Error Message: classification: Layer error: No data was found in classifier training input.

2

This error message, Error Message: classification: Layer error: No data was found in classifier training input. usually means what it says. If you print sampleData, you'll see it's an empty feature collection. Going backwards from that, I see that the geometries of points doesn't look the way they should:

print(points.aggregate_array('.geo'))

Something might have gone wrong when you uploaded the users/farhatlokmen/ecoModeling/falcoCherrug asset?

  • **THANK YOU! ** Finally the model worked. The following are details of the reason behind this mistake (which may help other people): Originally I was facing an error because I specified a label with elements like this "AT005". After searching, I learned of how the label elements need to be pure numbers as in "5". Therefore, I opened the csv file in Excel and made the necessary changes. The latter apparently changed the encoding of the file in some way (even though I made sure to save it as csv again). Moreover, I wasn't able to understand what happened because I did not refresh my asset list. – farhat May 11 '20 at 12:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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