Skip to content

Hyperspectral Image Classification Using Group-Aware Hierarchical Transformer

Notifications You must be signed in to change notification settings

MeiShaohui/Group-Aware-Hierarchical-Transformer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Group-Aware-Hierarchical-Transformer

This repository is the official implementation for our IEEE TGRS 2022 paper:

Hyperspectral image classification using group-aware hierarchical transformer

Last update: November 29, 2022

Requirements

python == 3.7.9, cuda == 11.1, and packages in requirements.txt

Datasets

Download following datasets:

Then organize these datasets like:

datasets/
  hrl/
    Loukia_GT.tif
    Loukia.tif
  pu/
    PaviaU_gt.mat
    PaviaU.mat
  sa/
    Salinas_corrected.mat
    Salinas_gt.mat
  whulk/
    WHU_Hi_LongKou_gt.mat
    WHU_Hi_LongKou.mat

Codes for Training and Validation

Train our proposed GAHT using train-val-test split ratios in the paper:

For the SA/PU/WHU-LK Dataset:

python main.py --model proposed --dataset_name sa --epoch 300 --bs 64 --device 0 --ratio 0.02
python main.py --model proposed --dataset_name pu --epoch 300 --bs 64 --device 0 --ratio 0.02
python main.py --model proposed --dataset_name whulk --epoch 300 --bs 64 --device 0 --ratio 0.01

For the HRL Dataset:

Transform the format of HRL dataset first:

python utils/tif2mat.py

Then train the model like other datasets:

python main.py --model proposed --dataset_name hrl --epoch 300 --bs 64 --device 0 --ratio 0.06

Evaluate the Model

python eval.py --model proposed --dataset_name sa --device 0 --weights ./checkpoints/proposed/sa/0
python eval.py --model proposed --dataset_name pu --device 0 --weights ./checkpoints/proposed/pu/0
python eval.py --model proposed --dataset_name whulk --device 0 --weights ./checkpoints/proposed/whulk/0
python eval.py --model proposed --dataset_name hrl --device 0 --weights ./checkpoints/proposed/hrl/0

Other Supported SOTA Methods:

Method Abbr. Parameter Paper
multi-scale3D deep convolutional neural network M3D-DCNN --model m3ddcnn here
CNN-based 3D deep learning approach 3D-CNN --model cnn3d here
deep feature fusion network DFFN --model dffn here
residual spectral-spatial attention network RSSAN --model rssan here
attention-based bidirectional long short-term memory network AB-LSTM --model ablstm here
transformer-based backbone network SF --model speformer here
spectral–spatial feature tokenization transformer SSFTT --model ssftt here

Citation

Please cite our paper if our work is helpful for your research.

@article{gaht,
  title={Hyperspectral image classification using group-aware hierarchical transformer},
  author={Mei, Shaohui and Song, Chao and Ma, Mingyang and Xu, Fulin},
  journal={IEEE Trans. Geosci. Remote Sens.},
  year={2022},
  volume={60},
  pages={1-14},
  doi={10.1109/TGRS.2022.3207933}}

Acknowledgement

Some of our codes references to the following projects, and we are thankful for their great work:

About

Hyperspectral Image Classification Using Group-Aware Hierarchical Transformer

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages