Land Cover/Use Classification using the Semi-Automatic Classification Plugin for QGIS

From AWF-Wiki
(Difference between revisions)
Jump to: navigation, search
(Collection of ROIs and Spectral signatures)
(Collection of ROIs and Spectral signatures)
Line 42: Line 42:
 
# Still under {{mitem|text=SCP Dock --> Classification dock --> ROI creation}}, set '''MC_ID''', '''C_ID''', '''MC_info''' and '''C_info''' (see table of the simplified [http://wiki.awf.forst.uni-goettingen.de/wiki/index.php/Training_data_selection_(SCP)#Defining_land_use.2Fcover_classes classification scheme]), and click on the button {{button|text=Save temporary roi to training input}} [[File:Qgis_scp_save_sig.png]] to record spectral signature.
 
# Still under {{mitem|text=SCP Dock --> Classification dock --> ROI creation}}, set '''MC_ID''', '''C_ID''', '''MC_info''' and '''C_info''' (see table of the simplified [http://wiki.awf.forst.uni-goettingen.de/wiki/index.php/Training_data_selection_(SCP)#Defining_land_use.2Fcover_classes classification scheme]), and click on the button {{button|text=Save temporary roi to training input}} [[File:Qgis_scp_save_sig.png]] to record spectral signature.
 
# Set custom colors for '''ROIs''' by double-clicking on a '''Color''' field from the {{button|text=ROI Signature list}}. A '''Select color''' window opens. Click first on an empty field below '''Custom colors'''. Then specify a value for '''Red''', '''Green''' and '''Blue''' using the RGB codes in the table of [http://wiki.awf.forst.uni-goettingen.de/wiki/index.php/Training_data_selection_(SCP)#Defining_land_use.2Fcover_classes classification scheme]. Click {{button|text=Add to Custom Colors}}.
 
# Set custom colors for '''ROIs''' by double-clicking on a '''Color''' field from the {{button|text=ROI Signature list}}. A '''Select color''' window opens. Click first on an empty field below '''Custom colors'''. Then specify a value for '''Red''', '''Green''' and '''Blue''' using the RGB codes in the table of [http://wiki.awf.forst.uni-goettingen.de/wiki/index.php/Training_data_selection_(SCP)#Defining_land_use.2Fcover_classes classification scheme]. Click {{button|text=Add to Custom Colors}}.
# Repeat step 6, 7 and 8, to record ROIs and spectral signatures for all several land cover / use classes.
+
# Repeat step 6, 7 and 8, to record ROIs and spectral signatures for all land cover / use classes.
  
 
[[File:Roi_1.png|600px]]
 
[[File:Roi_1.png|600px]]

Revision as of 12:47, 26 June 2019


Contents

Work steps

Preparing raster data (Converting DN to reflectance)

  • The Sentinel-2 products L1C and L2A are stored as digital numbers in data format unsigned integer 16bit. In this work step we scale the data to reflectance values with a new range from 0 to 1 and datatype float 32bit.
  • Load the single band raster file Subset_S2A_MSIL2A_20170619T_B2.tif and 9 other multipspectral bands (B3, B4, B5, B6, B7, B8, B11 and B12) of a Sentinel-2 scene.
  • Open Raster --> Raster Calculator....
  • Double click on a layer in the Raster bands list. The band should appear in the Raster calculator expression field.
  • Complete the expression with the multiplication operator * and 0.0001.
  • Specify an Output layer path and name.
  • Click OK
  • Repeat these steps for all other multispectral bands.

Qgis rastcalc boa.png

  • Follow Create stack to create a multiband raster file from the converted single bands and load into QGIS canvas.

Install and set up SCP plugin

  • Click Plugins --> Manage and Install Plugins.
  • Type in the search bar semi-Automatic Classification, click on the plugin name and then on Install plugin.

SCP plugin intall.png

  • Right-click on the QGIS main manu to open the Panels and make sure the following are checked SCP Dock, SCP Edit Toolbar, and SCP Working Toolbar.

SCP Tool.png

  • Load the multispectral Sentinel-2 reflectances with dataype float 32bit: \lucc\s2\Subset_S2A_MSIL2A_20170619T_MUL_BOA.tif into the QGIS canvas.
  • Data source Manager --> Browser --> XYZ Tiles. Select Google Satellite as background layer.
  • Load the European Urban Atlas as vector layer \lucc\\DE021L1_GOTTINGEN\Subset-Goe_DE021L1_GOTTINGEN_UA2012_UTM32N.shp

Defining classification inputs in SCP-plugin

We need to define input image, training input and spectral signature files for SCP.

  • In the SCP Dock click Band set Qgis scp bandset button.png or click Qgis scp bandset button2.png SCP Working toolbar --> Band set , use the button Refresh list Refresh list.PNG and the drop-down menu-bar to select the multiband reflectance file previously loaded into the QGIS canvas as input image.
  • Next, click Quick wavelength settings and select Sentinel-2 from the list in order to automatically set the Center wavelength for each band and the Wavelength unit.

Quick wavelength settings.png

  • In the RGB list Working toolbar.PNG of the Working Toolbar, type 3-2-1 to display natural color composite. Also, type 7-3-2 or 7-9-3 to display false color composites. While changing the color composite; also use the buttons cumulative_stretch Cum stretch.PNG and std_dev_stretch Stdv stretch.PNG for better displaying the Input image (i.e. image stretching).
  • We need to define training input file in order to collect ROIs and spectral signatures.
  • Click SCP Dock --> Training input, use the button Create a new training input Training input.PNG to create a training signature file with the extension .scp.

Scp input.png

Collection of ROIs and Spectral signatures

  1. ROIs can be created by drawing polygons using the button Create a ROI polygon Create polygon.PNG or by an automatic region growing algorithm using the button Activate ROI pointer ROI pointer.PNG. The region growing algorithm can create more homogeneous ROIs (i.e. standard deviation of spectral signature values is low) than manually drawn ones; the manual creation of ROIs can be useful in order to account for the spectral variability of classes. We will use the automatic region growing algorithm.
  2. From SCP Dock --> Training Input --> ROI option, check the function Display NDVI.
  3. Next, click the button Activate ROI pointer ROI pointer.PNG, and notice that the cursor displays NDVI value which changes over the image pixels.
  4. Zoom-in to the points and click on a land cover/use pixel associated with the point attribute to create a ROI.
  5. On the SCP Working Toolbar, increase the Dist parameter Dist.PNG (e.g. from 0.010000 to 0.100000). Define the number of selected pixels Min as 10 and Max as 30. Click the button Redo the roi at the same point Redo.PNG to capture more spectrally similar pixels.
  6. Still under SCP Dock --> Classification dock --> ROI creation, set MC_ID, C_ID, MC_info and C_info (see table of the simplified classification scheme), and click on the button Save temporary roi to training input Qgis scp save sig.png to record spectral signature.
  7. Set custom colors for ROIs by double-clicking on a Color field from the ROI Signature list. A Select color window opens. Click first on an empty field below Custom colors. Then specify a value for Red, Green and Blue using the RGB codes in the table of classification scheme. Click Add to Custom Colors.
  8. Repeat step 6, 7 and 8, to record ROIs and spectral signatures for all land cover / use classes.

Roi 1.png

Assess Spectral Signatures

Premise: Different materials may have similar spectral characteristics. Such pixels could be misclassified due to inability of classification algorithms to correctly discriminate those spectral signatures. Thus it is important to review spectral signatures of training samples and repeatedly modify them until all class training sets achieve adequate spectral separability. This can be done by 1) displaying and assessing spectral plots and/or 2) calculating the spectral distances of signatures.

  1. Highlight spectral signatures in the ROI Signature list and click the button Add highlighted signatures to spectral signature plot Spec sig plot.PNG to display signature plot.
  2. Disable/enable plot value range by checking/unchecking Plot value range.
  3. Observe differences between different pairs of land cover classes accross all wavelength ranges.
  4. Use the Automatic thresholds Auto treshold.PNG field to refine signature separability. It is also possible to refine the range within the plot. In the Plot Signature list, highlight a signature, click on the button Change value range interactively in the plot Edit range interactive.PNG, click inside the plot to reduce or increase range. (NB. classes are well separated if there is no overlap in at least one band)
  5. For the highlighted signatures click the button Calculate spectral distances Calc sig diff.PNG
  6. Click Signature details to unfold signature statistics for each wavelength range.
  7. Click Spectral distances to reveal spectral signature (dis)similarity metrics.
  8. To examine scatter plots for the highlighted signatures click the button Add highlighted items to scatter plot Sct plot.PNG to display scatter plot.

Spec plot.png


Plot no value range.png


Past AnnualCrop.png


Sig details.png Spec dist.png

Scatter plot.png

Classification

Land cover/use classification

Create some classification previews to get an overview of how the process will perform. This also helps to improve on the spectral signatures of training input for better classification results.

  1. Click SCP Dock --> Classification dock --> Macroclasses to set the colours for each class.
  2. Then under SCP Dock --> Classification dock --> Classification algorithm, check Use MCID to use Macroclass IDs for classification. For the algorithm, select Maximum Likelihood and under Land Cover Signature Classification check the box next to LCS.
  3. On the Working Toolbar click the button Preview pointer.PNG to activate the classificatin preview pointer.
  4. Then click a point on the image to display a classification preview in the map. Use the button Zoom to preview.PNG to zoom to the classification preview.

Classification can be performed after ROI creation and definition of spectral ranges.

  1. When satisfied with the preview and training input, check the box next to Algorithm under Land Cover Signature Classification.
  2. Open SCP Dock --> Classification dock --> Classification output and click the button Output button.PNG to specify an output destination. Be patient, processing needs some time! Results will be displayed in QGIS canvas after the processing.
  3. Repeat with other algorithms to compare their performance.

Accuracy Assessment

Automatic multiple ROI creation

  1. Repeat the steps under Defining classification inputs in SCP-plugin to create a new training input file (this will be the validation dataset). Use Subset_S2A_MSIL2A_20170619T_MUL_BOA.tif as input image
  2. Click SCP --> Tools --> Multiple ROI creation to set parameters for ROI creation using random points.
  3. Assuming we want to create 50 ROIs with a minimum distance of 500 map units from each other (to avoid overlaps), set Number of points to 50 Number of points.PNG, min distance to 200 and change the default ROI pixel size to Min 10 and Max 30). Set the Dist parameter to 0.03
  4. Since we are not interested in ROI signatures, uncheck Calculate sig. , click Create points. and at the bottom right corner of the window and click the button Output button.PNG to create multiple random ROIs.

Random roi creation.PNG

Photo-interpretation of ROIs

The created ROIs will appear under ROI Signature list in the Creation Dock. Observe that all created ROIs have the same class information (i.e. MC_ID, MC_Info, C_ID and C_Info). Thus we need to assign the correct class to each ROI. This will be done by photo-interpretation with the aid of different color composites (to identifiy different features) and high resolution Google satellite scenes (for this purpose, install OpenLayers plugin).

  1. Click Web --> OpenLayers plugin --> Google Maps --> Google Satellite to open Google satellite scene in QGIS.
  2. In the Layer panel drag the Google satellite scene to overlay the Subset_S2A_MSIL2A_20170619T_MUL_BOA.tif image.
  3. Double-click the first ROI under ROI Signature list to zoom in to the ROI.
  4. Open Properties --> Transparency and adjust the transparency of the Subset_S2A_MSIL2A_20170619T_MUL_BOA.tif image to view the Google satellite scene and correctly assign ROI class information (i.e. MC_ID, MC_Info, C_ID and C_Info).
  5. Repeat steps 3 and 4 to assign the correct class information for each ROI.

NB: Class information for the validation data must be in conformity with the classification scheme in the training dataset.

Calculation of classification accuracy

This involves a comparison of the output land cover/use map from image classification with the independent reference/validation dataset. The result is an error matrix which allows for the computation of descriptive accuracy statistics for the overall classification exercise (i.e. overall accuracy) but also the accuracy of individual classes either as producer accuracy or user accuracy.

  1. Load the validation data (lab5_validation.shp) in QGIS.
  2. Open SCP --> Postprocessing --> Accuracy.
  3. Under Select classification to assess, use the button Refresh list Refresh list.PNG and the drop-down menu-bar to select the output map from image classification.
  4. Under select the reference shapefile or raster, use the button Refresh list Refresh list.PNG and the drop-down menu-bar to select the validation sample.
  5. Under Shapefile field, select C_ID and click the button Output button.PNG to save the error raster and execute the process.

Postprocessing accuracy.PNG

Classification accuracy results.PNG

Personal tools
Namespaces

Variants
Actions
Navigation
Development
Toolbox
Print/export