Supervised classification (Tutorial)
From AWF-Wiki
Contents |
Classification with Orfeo Toolbox
Image statistics
- Add the LandSat-8 imagery SUB_LC81950242013188LGN00_MUL.tif into a QGIS project. It should be available in the course data.
- Calculate mean and standard error for each band of the LandSat-8 imagery.
- Open Orfeo Toolbox --> Compute images second order statistics (see figure A).
- Set SUB_LC81950242013188LGN00_MUL.tif as Input images.
- Save the Output XML file as SUB_LC81950242013188LGN00_mul.tif.xml.
Train image classifier
- Add the training areas training_manual_poly.shp into QGIS. It should be available in the course data.
- Open Orfeo Toolbox --> TrainImageClassifier (libsvm) to use the Support Vector Machine SVM algorithm (see figure B).
- Set SUB_LC81950242013188LGN00_MUL.tif as Input image list.
- Set training_manual_poly.shp as Input vector list.
- Set SUB_LC81950242013188LGN00_MUL.tif.xml as Input XML image statistics file.
- Set Name of discrimination field to C_ID (C_ID refers to the column that contain the LUC classes code).
- Save the Output confusion matrix as ConfusionMatrixSVM.csv.
- Save the Output model as SVM.model.
- Calculation of accuracies :
Open ConfusionMatrixSVM.csv in LibreOffice or MS Excel and calculate overall, producer and consumer accuracies.
Classification
- Add the cloud mask cloud_shadow_mask.tif into QGIS. It should be available in the course data.
- Open Orfeo Toolbox --> Image Classification (see figure C).
- Set SUB_LC81950242013188LGN00_MUL.tif as Input image.
- Set cloud_shadow_mask.tif as Input mask.
- Set SVM.model as Model file.
- Set SUB_LC81950242013188LGN00_MUL.tif.xml as Statistical file.
- Save the Output image as su_svm.tif.
- Evaluate classification results.
- Add the classification result su_svm.tif to QGIS.
- Right click su_svm.tif in the TOC and select Properties --> Style --> Style --> Load Style.
- Load classifcation.qml, which should be available in the course data.
- Open the Google Maps Layer under Web --> ObenLayers plugin --> Add Google Satellite layer and look for misclassification.
Compute a confusion matrix with independent reference data
- Open Orfeo Toolbox --> ComputeConfusionMatrix (Vector) (see figure D).
- Set su_svm.tif as Input image.
- Set train_systematic_seg.shp as Input reference vector data.
- Set Field name to C_ID.