4.9.9 TrainOGRLayersClassifier
Train a SVM classifier based on labeled geometries and a list of features to consider.
Detailed description
This application trains a SVM classifier based on labeled geometries and a list of features to consider for
classification.
Parameters
This section describes in details the parameters available for this application. Table 4.152, page 795
presents a summary of these parameters and the parameters keys to be used in command-line and
programming languages. Application key is TrainOGRLayersClassifier.
|
|
|
Parameter key | Parameter type |
Parameter description |
| | |
|
|
|
inshp | Input vector data |
Name of the input shapefile |
instats | Input File name |
XML file containing mean and variance
of each feature. |
outsvm | Output File name |
Output model filename. |
feat | List |
List of features to consider for
classification. |
cfield | String |
Field containing the class id for
supervision |
inxml | XML input parameters file |
Load otb application from xml file |
outxml | XML output parameters file |
Save otb application to xml file |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Table 4.152: Parameters table for TrainOGRLayersClassifier.
- Name of the input shapefile: Name of the input shapefile
- XML file containing mean and variance of each feature.: XML file containing mean and
variance of each feature.
- Output model filename.: Output model filename.
- List of features to consider for classification.: List of features to consider for classification.
- Field containing the class id for supervision: Field containing the class id for supervision.
Only geometries with this field available will be taken into account.
- Load otb application from xml file: Load otb application from xml file
- Save otb application to xml file: Save otb application to xml file
Example
To run this example in command-line, use the following:
otbcli_TrainOGRLayersClassifier -inshp vectorData.shp -instats meanVar.xml -outsvm svmModel.svm -feat perimeter -cfield predicted
To run this example from Python, use the following code snippet:
#!/usr/bin/python # Import the otb applications package import otbApplication # The following line creates an instance of the TrainOGRLayersClassifier application TrainOGRLayersClassifier = otbApplication.Registry.CreateApplication("TrainOGRLayersClassifier") # The following lines set all the application parameters: TrainOGRLayersClassifier.SetParameterString("inshp", "vectorData.shp") TrainOGRLayersClassifier.SetParameterString("instats", "meanVar.xml") TrainOGRLayersClassifier.SetParameterString("outsvm", "svmModel.svm") # The following line execute the application TrainOGRLayersClassifier.ExecuteAndWriteOutput()
Limitations
Experimental. For now only shapefiles are supported. Tuning of SVM classifier is not available.
Authors
This application has been written by David Youssefi during internship at CNES.
See also
These additional ressources can be useful for further information:
- OGRLayerClassifier,ComputeOGRLayersFeaturesStatistics