ComputeConfusionMatrix

计算分类的混淆矩阵

描述

这个应用程序计算分类地图相对于地面事实数据集的混淆矩阵。地面实况可以以栅格或矢量数据的形式提供。在计算混淆矩阵时,仅处理具有不同于NoData的值的参考像素和产生的像素。混淆矩阵按以下方式组织:行=参考标签,列=产生的标签。在输出文件的头中,引用和生成的类标签根据混淆矩阵的行/列进行排序。

参数

Input Image -in image Mandatory
The input classification image.

Matrix output -out filename [dtype] Mandatory
Filename to store the output matrix (csv format)

set the output format to contingency table or confusion matrix -format [confusionmatrix|contingencytable] Default value: confusionmatrix
Choice of the output format as a contingency table for unsupervised algorithmsor confusion matrix for supervised ones.

  • Choice of a confusion matrix as output.
  • Choice of a contingency table as output.

Ground truth -ref [raster|vector] Default value: raster
Choice of ground truth format

  • Ground truth as a raster image
  • Ground truth as a vector data file

作为栅格图像的地面真实图像选项

Input reference image -ref.raster.in image Mandatory
Input image containing the ground truth labels

Value for nodata pixels in the reference raster -ref.raster.nodata int Default value: 0
Label to be treated as nodata in the reference raster.

将真实数据作为矢量数据文件选项

Input reference vector data -ref.vector.in vectorfile Mandatory
Input vector data of the ground truth

Field name -ref.vector.field string
Field name containing the label values

Value for nodata pixels in the reference vector -ref.vector.nodata int Default value: 0
Label to be treated as nodata in the reference vector. Please note that this value is always used in vector mode, to generate default values. Please set it to a value that does not correspond to a class label.


Value for nodata pixels in the input image -nodatalabel int Default value: 0
Label to be treated as nodata in the input image

Available RAM (MB) -ram int Default value: 256
Available memory for processing (in MB).

实例

从命令行执行以下操作:

otbcli_ComputeConfusionMatrix -in clLabeledImageQB1.tif -out ConfusionMatrix.csv -ref vector -ref.vector.in VectorData_QB1_bis.shp -ref.vector.field Class -ref.vector.nodata 255

来自Python的评论:

import otbApplication

app = otbApplication.Registry.CreateApplication("ComputeConfusionMatrix")

app.SetParameterString("in", "clLabeledImageQB1.tif")
app.SetParameterString("out", "ConfusionMatrix.csv")
app.SetParameterString("ref","vector")
app.SetParameterString("ref.vector.in", "VectorData_QB1_bis.shp")
app.SetParameterString("ref.vector.field", "Class")
app.SetParameterInt("ref.vector.nodata", 255)

app.ExecuteAndWriteOutput()