Awesome
Semi-Supervised Hyperspectral Image Classification Using a Probabilistic Pseudo-Label Generation Framework
IEEE Transactions on Geoscience and Remote Sensing (2022)
Paper | [preprint]
Pytorch implementation of the residual center-based pseudo label generator (Res-CP) for classification of hyperspectral images. Please kindly note that this code cannot reproduce the exact results that reported in this Paper. The accuracy results are reported based on Keras-Tensorflow implementation, which will be released soon!
BibTeX
@article{seydgar2022semi,
title={Semi-Supervised Hyperspectral Image Classification Using a Probabilistic Pseudo-Label Generation Framework},
author={Seydgar, Majid and Rahnamayan, Shahryar and Ghamisi, Pedram and Bidgoli, Azam Asilian},
journal={IEEE Transactions on Geoscience and Remote Sensing},
year={2022},
publisher={IEEE}
}
Install
If you have installed Anaconda and Git on your operating system, simply run the following codes in your terminal (command prompt in Windows).
# step 1. clone this repo
git clone https://github.com/majidseydgar/Res-CP.git
cd Res-CP
# step 2. create a conda virtual environment and activate it
conda create -n ResCP python=3.6 -y
conda activate ResCP
conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch
pip install scikit-learn scipy tqdm matplotlib argparse
Alternatively, you can manually download the repository, and then install the packages by using pip.
# Optional solution for step 2: install libs step by step
pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu113
pip install scikit-learn scipy tqdm matplotlib argparse
Model Zoo
- The Res-CP is a semi-supervised learning framework which can generate reliable pseudo labels to enhance the classification results of hyperspectral image classification methods if limited labeled data is available.
- This framework can achieve more than 95% OA for University of Pavia, Salinas, and Kennedy Space Center datasets, respectively, using classification models, such as PRCLSTMII, SSRN.
- The embedding features obtained by RCN can be found here. Put this file in "log/RCN/" and unzip it to reproduce the classification results.
- Stay tuned. More optimized versions of Pytorch implementation and results will be uploaded.
News & Updates:
- pytorch-based implementation of RCN.
- Optimized version uploaded.
- Matlab-based implementation of PLG.
- Python-based implementation of PLG
- PRCLSTMII code release.
- PRCLSTMII without recurrent regularization.
- Original keras-tensorflow implementation code release.
Datasets
The .mat files of the University of Pavia, Salinas, and Kennedy space center are publicly available at: www.ehu.eus
To produce .mat files of University of Houston, please see the tutorial of Shuguang Dou.
Place University of Pavia and its ground truth in "Dataset/UP/" folder.
Place Salinas and its ground truth in "Dataset/SA/" folder.
Place Kennedy space center and its ground truth in "Dataset/KSC/" folder.
After generating University of Houston after .mat files, place them in "Dataset/UH/" folder.
Usage
The framework contains three main components, 1-RCN for feature embedding (encoding), 2-PLG for pseudo label generation, and 3-Classifications to perform classifications using the generated pseudo labels and test the model on real ground truth.
You can open the terminal in a main directory (Res-CP)
1-RCN (feature encoding)
If you want to reproduce the embedding features, open the terminal in the main directory ("Res-CP" folder) and then run:
# train University of Pavia
python 1-RCN/main.py --dataset SA --emb
You can replace UP, KSC, or UH instead of SA after--dataset
to reproduce the features for other datasets, as well.
Note that --emb
flag automatically create "log/1-RCN" parent folder and exports the embedded features in the "log/1-RCN/embeddings" folder.
2-PLG (pseudo label generator)
- Currently, you need to have MATLAB to reproduce the PLG results. To do that, simply run the
PLG.m
code; type the name of the dataset (UP, SA, KSC) and press Enter. the pseudo label filesnew_train.mat
will be saved in the folder of target dataset. - Stay tune, Python version will be added soon.
3-Classifications
After generating the pseudo labels, open the terminal in the main directory ("Res-CP" folder) and then run:
python 3-Classifications/main.py --dataset SA
You can add the --model
flag to change the classification model. Currently, the SSRN is a default classification model.
The PRCLSTM and the PRCLSTMII will be added soon.
Acknowledgment
Our implementation is, mainly, based on the following repositories. We gratefully thank the authors for their wonderful works.