Google Earth Engine(GEE)—— ConfusionMatrix (Error)Property ‘landcover‘ of feature ‘1_1_1_1_1_1_1_1

简介: Google Earth Engine(GEE)—— ConfusionMatrix (Error)Property ‘landcover‘ of feature ‘1_1_1_1_1_1_1_1

你有时候会不会有道这样的问题:

ConfusionMatrix (Error)

Property 'landcover' of feature '1_1_1_1_1_1_1_1_0_0' is missing.

我这里举一个例子,很多时候我们在进行混淆矩阵分析的时候都会出现这个状况,这个状况出现的主要原因是我们缺少了关键的属性名称。比如我们要做分类我们缺少了一个属性,需要”landcover“,在这之前我们首先要确保我们每一个所选的样本点都包含这个属性,但是不需要固定的名称,可以随便,只要在分类的时候让其拥有这个属性即可。

在此之前还需要确保每一个你选的样本点集合都是矢量集合,这样才能才可能继续分类。

解决方案:样本点属性设置进行修改

错误似乎出现在第11行,var newfc = urban.merge(vegetation).merge(water).merge(urban).merge(fields);

确保urban和其他是配置几何导入工具中的一个FeatureCollection。

添加属性 "土地覆盖",数值1代表城市,2代表水,以此类推。

你可以检查print(newfc)并查看属性,检查特征 "1_1_1_0_0"。

之前的代码:这里我们需要修改的不是代码本身而是样本点的属性,记住这一点就行了

var landsatCollection = ee.ImageCollection('LANDSAT/LC08/C01/T1')
    .filterDate('2017-01-01', '2017-12-31');
// Make a cloud-free composite.
var composite = ee.Algorithms.Landsat.simpleComposite({
  collection: landsatCollection,
  asFloat: true
});
// Merge the three geometry layers into a single FeatureCollection.
var newfc = urban.merge(vegetation).merge(water).merge(urban).merge(fields);
// Use these bands for classification.
var bands = ['B2', 'B3', 'B4', 'B5', 'B6', 'B7'];
// The name of the property on the points storing the class label.
var classProperty = 'landcover';
// Sample the composite to generate training data.  Note that the
// class label is stored in the 'landcover' property.
var training = composite.select(bands).sampleRegions({
  collection: newfc,
  properties: [classProperty],
  scale: 30
});
// Train a CART classifier.
var classifier = ee.Classifier.smileCart().train({
  features: training,
  classProperty: [classProperty],
});
// Print some info about the classifier (specific to CART).
print('CART, explained', classifier.explain());
// Classify the composite.
var classified = composite.classify(classifier);
Map.centerObject(newfc);
Map.addLayer(classified, {min: 0, max: 3, palette: ['red', 'blue', 'green','yellow']});
// Optionally, do some accuracy assessment.  Fist, add a column of
// random uniforms to the training dataset.
var withRandom = training.randomColumn('random');
// We want to reserve some of the data for testing, to avoid overfitting the model.
var split = 0.7;  // Roughly 70% training, 30% testing.
var trainingPartition = withRandom.filter(ee.Filter.lt('random', split));
var testingPartition = withRandom.filter(ee.Filter.gte('random', split));
// Trained with 70% of our data.
var trainedClassifier = ee.Classifier.smileCart().train({
  features: trainingPartition,
  classProperty: classProperty,
  inputProperties: bands
});
// Classify the test FeatureCollection.
var test = testingPartition.classify(trainedClassifier);
// Print the confusion matrix.
var confusionMatrix = test.errorMatrix(classProperty, 'classification');
print('Confusion Matrix', confusionMatrix);
相关文章
|
6天前
|
数据可视化 定位技术 Sentinel
如何用Google Earth Engine快速、大量下载遥感影像数据?
【2月更文挑战第9天】本文介绍在谷歌地球引擎(Google Earth Engine,GEE)中,批量下载指定时间范围、空间范围的遥感影像数据(包括Landsat、Sentinel等)的方法~
715 0
如何用Google Earth Engine快速、大量下载遥感影像数据?
|
6天前
Error:java.util.zip.ZipException: duplicate entry: com/google/firebase/iid/zzc.class ,EvalIssueExcep
Error:java.util.zip.ZipException: duplicate entry: com/google/firebase/iid/zzc.class ,EvalIssueExcep
26 0
|
6天前
|
机器学习/深度学习 算法 数据可视化
基于Google Earth Engine云平台构建的多源遥感数据森林地上生物量AGB估算模型含生物量模型应用APP
基于Google Earth Engine云平台构建的多源遥感数据森林地上生物量AGB估算模型含生物量模型应用APP
115 0
|
6天前
GEE——Google dynamic world中在影像导出过程中无法完全导出较大面积影像的解决方案(投影的转换)EPSG:32630和EPSG:4326的区别
GEE——Google dynamic world中在影像导出过程中无法完全导出较大面积影像的解决方案(投影的转换)EPSG:32630和EPSG:4326的区别
49 0
|
6天前
|
存储 编解码 数据可视化
Google Earth Engine获取随机抽样点并均匀分布在栅格的不同数值区中
【2月更文挑战第14天】本文介绍在谷歌地球引擎(Google Earth Engine,GEE)中,按照给定的地表分类数据,对每一种不同的地物类型,分别加以全球范围内随机抽样点自动批量选取的方法~
279 0
Google Earth Engine获取随机抽样点并均匀分布在栅格的不同数值区中
|
6天前
|
API Go 网络架构
GEE Colab——如何从本地/Google云盘/Google Cloud Storage (GCS)上传和下载
GEE Colab——如何从本地/Google云盘/Google Cloud Storage (GCS)上传和下载
106 4
|
6天前
|
机器学习/深度学习 存储 人工智能
GEE Colab——初学者福音快速入门 Google Colab(Colaboratory)
GEE Colab——初学者福音快速入门 Google Colab(Colaboratory)
87 3
|
6天前
|
数据处理
Google Earth Engine(GEE)——sentinel-1数据处理过程中出现错误Dictionary does not contain key: bucketMeans
Google Earth Engine(GEE)——sentinel-1数据处理过程中出现错误Dictionary does not contain key: bucketMeans
33 0
|
6天前
|
编解码 人工智能 算法
Google Earth Engine——促进森林温室气体报告的全球时间序列数据集
Google Earth Engine——促进森林温室气体报告的全球时间序列数据集
33 0
|
6天前
|
编解码 人工智能 数据库
Google Earth Engine(GEE)——全球道路盘查项目全球道路数据库
Google Earth Engine(GEE)——全球道路盘查项目全球道路数据库
49 0

热门文章

最新文章