MDL4OW Few-shot Hyperspectral Image Classification With Unknown Classes Using Multitask Deep Learning.
Open-Set Hyperspectral Image Classification.
Shengjie Liu, Qian Shi, and Liangpei Zhang. Few-shot Hyperspectral Image Classification With Unknown Classes Using Multitask Deep Learning. IEEE TGRS, 2020. doi:10.1109/TGRS.2020.3018879
Overview
Ordinary: misclassify road, house, helicopter, and truck
Below is a normal/closed classification. If you are familiar with hyperspectral data, you will notice some of the materials are not represented in the training samples. For example, for the upper image (Salinas Valley), the road and the houses between farmlands cannot be classified into any of the known classes. But still, a deep learning model has to assign one of the labels, because it is never taught to identify an unknown instance.
What we do: mask out the unknown in black
What we do here is, by using multitask deep learning, empowering the deep learning model with the ability to
identify the unknown: those masked with black color.
For the upper image (Salinas Valley), the roads and houses between farmlands are successfully
identified.
For the lower image (University of Pavia Campus), helicopters and trucks are successfully identified.
Key packages
tensorflow-gpu==1.9
keras==2.1.6
libmr
Tested on Python 3.6, Windows 10
Recommend Anaconda, Spyder
How to use
Hyperspectral satellite images
The input image is with size of imx*imy*channel.
The satellite images are standard data, downloaded here: http://www.ehu.eus/ccwintco/index.php/Hyperspectral_Remote_Sensing_Scenes
The above data is in matlab format, the numpy format can be found here (recommended):
https://drive.google.com/file/d/1cEpTuP-trfRuphKWqKHjAaJhek5sqI3C/view?usp=sharing
Quick usage
python demo_salinas.py
Arguments
Command-line Arguments:
-
--nos: Number of training samples per class
20 for few-shot learning, 200 for many-shot learning -
--key: Dataset name
Options:'salinas','paviaU','indian' -
--gt: Path to ground truth file -
--closs: Classification loss weight
Default:50(equivalent to 0.5 in normalized scale) -
--patience: Early stopping patience
Stop training if loss doesn't decrease for{patience}consecutive epochs -
--output: Directory path to save output files
Includes: trained model, prediction probabilities, predicted labels, reconstruction loss -
--showmap: Save classification map as image
When enabled, generates and saves the predicted label map visualization
Evaluation code updated on 18 May 2021
When using the evaluation code "z20210518a_readoa.py", you should change the parameter
"mode" for different settings. The inputs are output files from the training script.
Mode
Mode Selection:
mode == 0: Closed-set classificationmode == 1: MDL4OW (Minimum Distance to Learned Open-set Weights)mode == 2: MDL4OW/C (with confidence calibration)mode == 3: Closed-set with probability outputmode == 4: Softmax with thresholdmode == 5: OpenMax (for open-set recognition)