Exercise 6 - Classification I
Task 1
Python exercise for classification based on a univariate Gaussian classifier.
Step 1: Implement a Gaussian classifier using a single feature at a time
For the algorithm, see lecture slides or the notes.
The images tm1.png
through tm6.png
contain the 6 original bands of a
Landsat satellite image of Kjeller (corresponding to different wavelengths),
and can be found in the image folder.
For all images, do Step 2.
Step 2: Train the classifier
Train the classifier on the images tm*.png
using the 4 classes defined in the
mask image tm_train.png
. You do this by computing the mean vector and
variance for each class based on the pixels with class label in the
training mask image.
Classify all pixels in the image and save the estimated class labels in an image. Display this image.
Compute the classification error by counting the bumber of misclassified pixels
in the test mask tm_test.png
, which contains the true labels for the test
pixels.
Note that we have one satellite image, and only the pixels in the training mask are used to estimate the mean and variance parameters. Only the pixels in the test mask are used to compute the classification accuracy. We can still display the entire classified image to look at the result.
Step 3: Find the best feature for classification using single features
Compute the percentage of correctly classified pixels for each of the features alone, and find the accuracy for the best single feature.