Tutorial%3A Supervised_Classification

Install the semi-automatic classification plugin (SCP)[edit]

If you have not installed it yet, please install the semi-automatic classification plugin. We will use it to perform the classification. Here’s a guide on installation and a video on the functions of the plugin.

Load bands[edit]

Open the plugin by clicking on the icon in the working toolbar, then go to Band set. Add the bands (already loaded in QGIS) via the + button. Alternatively you can add bands directly from your computer via the folder icon above. Under Band quick settings choose the sensor (Sentinel-2). Here’s an overview of the Sentinel-2 bands. Then click Run.

Band set.jpg

Visually assess land cover[edit]

Close the SCP window. In the working toolbar, use the RGB = field to visually assess the satellite images.

To create a true colour image, type 4-3-2. A temporary virtual band set will be added to your layers panel. You can explore different band combinations, e.g. if you type 7-3-2 vegetation will appear in red. Here’s an overview of possible RGB composites for Sentinel-2 images Based on your interpretation of the image, come up with a classification system (e.g. water, vegetation, infrastructure, agriculture,...).

Virtual band.jpg

Create a new training input[edit]

In the SCP Dock click on training input and then create new training input. Assign a name / location.

SCP Dock.jpg

Add ROIs to the training input[edit]

Now you can add regions of interest (ROIs) to the training input and assign classes using the working tool bar. 1) Zoom into the image. 2) Click on the polygon icon. 3) Left click to draw a polygon around a feature in the image that corresponds to a class you want to identify. Finish the polygon with a right click.

Forest.jpg

The polygon will be added to the training input. Here you can assign the correct class. For example, here Macroclass (MC) ID = 1 corresponds to “Forest”.

Repeat until you have sufficient training data for each class you want to distinguish. It is possible to assign different classes within a macroclass, e.g. if MC = 2 is “Water”, classes might be “Lake” or “River”.

Note: Make sure to assign the correct class IDs and mind that the C ID is automatically increased by 1 for every new ROI.

Lake.jpg
River.jpg

Classification settings[edit]

Next, we will adjust the classification settings. 1) Open the SCP window. 2) Go to Band processing → Classification. 3) Make sure the right band set is selected in case you have multiple added. In this example, we will classify based on MC ID only. 4) Choose a classification algorithm. You can try out different ones, in this example, we will use Minimum Distance. You can find a detailed explanation of the different algorithms available here.

RUN.jpg

Before running the classification, consider generating a preview.

Classification Preview[edit]

Before running the classification, you can generate a preview to get an idea of what the result will look like. This will help you to decide whether the training input is sufficient.

For easier visual interpretation, first change the colours assigned to the macroclasses in the training input by double-clicking on them. Then click on the preview (+) icon in the working toolbar. Now you can click anywhere in the image to generate a small preview of the classification of that area.

Visually assess the accuracy and add more training data if necessary, e.g. in this example water and forest were picked up quite well, but there is some confusion between soil (agriculture) and infrastructure, so you might want to add more training data to these classes or reconsider the classification system.

Field.jpg

Once the preview looks good, go back to the SCP window and run the classification.

Assess the result[edit]

Compare your classification visually to the satellite image to get an idea of the accuracy of the classification and any errors that occured. To quantitatively assess the accuracy of your classification, you should perform an accuracy assessment. This will be explained in a separate tutorial.

There are several options in the SCP to refine your classification such as the sieve option to remove isolated pixels or the edit option to manually reassign pixels to a different class. You can also turn the classification into a vector if desired.

Tutorial.jpg

Classification report (optional)[edit]

Once the classification is finished, you can generate a classification report. In the SCP, go to Postprocessing → Classification report. Then select your classification (you might have to click the refresh button first) and click Run.

Report.jpg

The classification report will tell you the percentages and the area sizes for each class.

Plugin.jpg

The authors of this entry are Neha Chauhan and Christoph Schwenck. Hannah Metke, Carlo Krügermeier and Ben Richter wrote the tutorials.