Skip to content

The repository contains the implementation of the paper "SwinMSP: A Shifted Windows Masked Spectral Pretraining Model for Hyperspectral Image Classification"

Notifications You must be signed in to change notification settings

teaRRe/Swin-MSP

Repository files navigation

SwinMSP: A Shifted Windows Masked Spectral Pretraining Model for Hyperspectral Image Classification

[Paper]

The repository contains the implementation of the paper "SwinMSP: A Shifted Windows Masked Spectral Pretraining Model for Hyperspectral Image Classification"

SwinMSP.png

Installation

pip install -r requirements.txt

You may install torch and torchvision manually.

torch==1.12.0
torchvision==0.13.0

Usage

Paste .mat file and .pth file in hsi_data/ and output/swin_msp_pt/ respectively. you can download from the following links:

Dataset mat file weights file
PaviaU PaviaU.mat
PaviaU_gt.mat
download

Fine-tune

For PaviUniversity Dataset:

Specify the weight file path in the --pretrained parameter, such as output/swin_msp_pt/PaviaU/ckpt_epoch_499.pth:

python swin_msp_ft.py --cfg configs/finetune/swin_msp_ft_pu.yaml --pretrained output/swin_msp_pt/PaviaU/ckpt_epoch_499.pth --runs 10

The results will be saved in the cls_result directory. The class map will be saved in the cls_map directory. The running log will be saved in the log directory. The weights will be saved in the output directory.

Pre-train

For PaviUniversity Dataset:
python swin_msp_pt.py --cfg configs/pretrain/swin_mae_pt_pu.yaml --tag swin_msp_pt_pu

Citation

@ARTICLE{10606196,
  author={Tian, Rui and Liu, Danqing and Bai, Yu and Jin, Yu and Wan, Guanliang and Guo, Yanhui},
  journal={IEEE Transactions on Geoscience and Remote Sensing}, 
  title={Swin-MSP: A Shifted Windows Masked Spectral Pretraining Model for Hyperspectral Image Classification}, 
  year={2024},
  volume={62},
  number={},
  pages={1-14},
  keywords={Hyperspectral imaging;Task analysis;Feature extraction;Image classification;Computer architecture;Computational modeling;Long short term memory;Hyperspectral image (HSI) classification;pretraining model;Swin-MAE;transformer},
  doi={10.1109/TGRS.2024.3431517}}

Acknowledgement


DeepHyperX, Swin-Transformer, Swin-MAE, SpectralFormer, MAEST, morphFormer

About

The repository contains the implementation of the paper "SwinMSP: A Shifted Windows Masked Spectral Pretraining Model for Hyperspectral Image Classification"

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages