VectorClassifier - Vector Classification¶
Performs a classification of the input vector data according to a model file.Features of the vector data output will contain the class labels decided by the classifier (maximal class label = 65535).
Detailed description¶
This application performs a vector data classification based on a model file produced by the TrainVectorClassifier application.
Parameters¶
This section describes in details the parameters available for this application. Table [1] presents a summary of these parameters and the parameters keys to be used in command-line and programming languages. Application key is VectorClassifier .
[1] | Table: Parameters table for Vector Classification. |
Parameter Key | Parameter Name | Parameter Type |
---|---|---|
in | Name of the input vector data | Input vector data |
instat | Statistics file | Input File name |
model | Model file | Input File name |
cfield | Field containing the predicted class | String |
feat | Field names to be calculated. | List |
confmap | Confidence map | Boolean |
out | Output vector data file containing class labels | Output File name |
inxml | Load otb application from xml file | XML input parameters file |
outxml | Save otb application to xml file | XML output parameters file |
- Name of the input vector data: The input vector data to classify.
- Statistics file: A XML file containing mean and standard deviation to centerand reduce samples before classification (produced by ComputeImagesStatistics application).
- Model file: A model file (produced by TrainVectorClassifier application,maximal class label = 65535).
- Field containing the predicted class: Field containing the predicted class.Only geometries with this field available will be taken into account.
- Field names to be calculated.: List of field names in the input vector data used as features for training.
- Confidence map: Confidence map of the produced classification. The confidence index depends on the model : - LibSVM : difference between the two highest probabilities (needs a model with probability estimates, so that classes probabilities can be computed for each sample) - OpenCV * Boost : sum of votes * DecisionTree : (not supported) * GradientBoostedTree : (not supported) * KNearestNeighbors : number of neighbors with the same label * NeuralNetwork : difference between the two highest responses * NormalBayes : (not supported) * RandomForest : Confidence (proportion of votes for the majority class). Margin (normalized difference of the votes of the 2 majority classes) is not available for now. * SVM : distance to margin (only works for 2-class models) .
- Output vector data file containing class labels: Output vector data file storing sample values (OGR format).If not given, the input vector data file is updated.
- 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_VectorClassifier -in vectorData.shp -instat meanVar.xml -model svmModel.svm -out svmModel.svm -feat perimeter area width -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 VectorClassifier application
VectorClassifier = otbApplication.Registry.CreateApplication("VectorClassifier")
# The following lines set all the application parameters:
VectorClassifier.SetParameterString("in", "vectorData.shp")
VectorClassifier.SetParameterString("instat", "meanVar.xml")
VectorClassifier.SetParameterString("model", "svmModel.svm")
VectorClassifier.SetParameterString("out", "svmModel.svm")
# The following line execute the application
VectorClassifier.ExecuteAndWriteOutput()
Limitations¶
Shapefiles are supported. But the SQLite format is only supported in update mode.
Authors¶
This application has been written by OTB-Team.