Assignment 02

Classification of a Sentinel-2 image

Deadline is 6 October 2020 at 10:00.

Late submission? 10% will be removed for each day that you are late.

You’re allowed for this assignment to work in a group of 2 (and thus submit only one solution for both of you). You are free to form a group yourself; if you’re looking for a partner let me know (Hugo), or let others know on Discord. If you prefer to work alone it’s also fine.

twitch.tv of the feedback session + slides of the feedback session

voxelised model



Overview

The aim of this assignment is implement in Python a program that classifies a Sentinel-2 image.

You have to implement your solution in a Jupyter notebook, and submit this notebook.

What you are given to start

S2A_MSIL2A_20200530T105031_N0214_R051_T31UET_20200530T134211.zip

This is the satellite image for the area around Delft on 2020-05-30, with 3 resolutions.

You have to classify 2 resolutions:

  1. the whole 60m image
  2. a subset of the 10m (see details below)

These 2 might require different parameters, it is up to you to tell me.

Notice that you are not allowed to crop and merge and modify the images with QGIS or rio (as you potentially did in the NDVI lab), your code should read the original files in the ZIP (the .jp2 files). I will run your code.

The path given should be relative to the root of the Sentinel-2 folder I give you, eg:

import rasterio
ds = rasterio.open('./GRANULE/L2A_T31UET_A025788_20200530T105134/IMG_DATA/R10m/T31UET_20200530T105031_B02_10m.jp2')

Classification

For the classification, you are free to try and experiment with the methods you want, but you are required to at least use the k-means clustering method.

You can try different classification methods, and compare them.

The number of classes that should be used is up to you, I want you to discover what is possible with the data you have. These experiments form the report that you submit, explain me with examples how many classes you used, and why.

Subset of the 10m image

Since classifying the whole 10m might take too much time, you only need to apply the clustering on a subset, as shown here. You need to obtain an image of (row=700, col=500), and the top-left is the pixel containing the coordinate (601200.0, 5773695.0).

tip: use the “Windowed” functions in rasterio.

Python packages

You are allowed to use any packages from the Python standard library, and the following are allowed and recommended:

  1. numpy
  2. scikit-learn (for the k-means clustering; many other clustering algorithms are implemented)
  3. matplotlib (to plot)

If you want to use other ones: just ask on Discord.

Tips

Deliverable

You have to submit the Jupyter notebook by uploading there, either:

In the Jupyter notebook, please write at the top your names and studentIDs.

This notebook is both your report (so with a description of what you’ve done), your analysis of the results (eg with plots to show me results), and your code (I will try to run your code too).

For the report part of the notebook, you should explain briefly how you solved the key parts of the task and why you chose to implement them in this manner. You do not need to put comments to explain me that this line of code is to load an image for instance, this is trivial.

Focus on high-level descriptions of how things work, not on explaining your code line by line. Discuss the pros and cons of your method, assess the quality of your results and the performance of your code.

I don’t expect magical results for the classification—just document what works well and what doesn’t.

Marking

Criterion Points
followed all rules and compiles/runs without modifications 2
quality of report 3
code 2
analysis and explanation (quality/clarity) 3

[last updated: 2020-09-21 10:02]