Vector Classification

Hi everyone,

How to use the “Vector Classification” tool?, I’m traying to make a classification using stratifield statistic means of the polygon segmentation, nevertheless, how much squeeze the process is creating a new field in the shape file that should have value of the classes, based on the model generated in the traininimagesClassifer. Although a new field is created in the shape file processed in the “Vector Classification” the values that appear are 1 for all polygons. This process should create a new field with class values based on the media model, but not generate.

Someone can help me?



If I understand correctly you are trying to:

  • Train a supervised classifier on an image :
otbcli_TrainImagesClassifier -classifier rf inputImage  -io.vd classif_train.shp -io.out model.txt   -sample.vfn classlabel
  • Apply segmentation to this image, e.g.
otbcli_Segmentation  -in ../S2A_ROI.tif -mode.vector.out segmentation.shp -filter watershed
  • Compute the mean on each resulting segment, for each band of the input image, e.g.
otbcli_ZonalStatistics  -in ../S2A_ROI.tif segmentation.shp -out.vector.filename zonalStats.shp
  • Perform classification on the segment, using the trained model and the computed means:
otbcli_VectorClassifier  -in zonalStats.shp -model model.txt -feat mean_0 mean_1 mean_2 mean_3  -cfield predicted -out objectClassification.shp

I just tried it on some test data with the mentioned applications, and it works pretty well! If this is what you are trying to do.

Hope that helps,