OGRLayerClassifier¶
根据机器学习模型和要考虑的功能列表对OGR层进行分类。
描述¶
该应用程序将对所选要素应用经过训练的机器学习模型,以获得OGR层中包含的每个几何图形的分类。功能列表必须与用于培训的列表匹配。预测标签将写入每个几何图形的用户定义字段中。
参数¶
Name of the input shapefile -inshp vectorfile
Mandatory
Name of the input shapefile
XML file containing mean and variance of each feature -instats filename [dtype]
Mandatory
XML file containing mean and variance of each feature.
Input model filename -insvm filename [dtype]
Mandatory
Input model filename.
Features -feat string1 string2...
Features to be calculated
Field containing the predicted class -cfield string
Default value: predicted
Field containing the predicted class
实例¶
从命令行执行以下操作:
otbcli_OGRLayerClassifier -inshp vectorData.shp -instats meanVar.xml -insvm svmModel.svm -feat perimeter -cfield predicted
来自Python的评论:
import otbApplication
app = otbApplication.Registry.CreateApplication("OGRLayerClassifier")
app.SetParameterString("inshp", "vectorData.shp")
app.SetParameterString("instats", "meanVar.xml")
app.SetParameterString("insvm", "svmModel.svm")
app.SetParameterStringList("feat", ['perimeter'])
app.SetParameterString("cfield", "predicted")
app.ExecuteAndWriteOutput()
局限性¶
实验性的。目前仅支持shapefile。