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
python == 3.7.9, cuda == 11.1, and packages in requirements.txt
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
Train our proposed GAHT using train-val-test split ratios in the paper:
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
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
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
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 |
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}}
Some of our codes references to the following projects, and we are thankful for their great work: