The repository contains the implementation of the paper "SwinMSP: A Shifted Windows Masked Spectral Pretraining Model for Hyperspectral Image Classification"
pip install -r requirements.txtYou may install torch and torchvision manually.
torch==1.12.0
torchvision==0.13.0Paste .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 |
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 10The 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.
python swin_msp_pt.py --cfg configs/pretrain/swin_mae_pt_pu.yaml --tag swin_msp_pt_pu@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}}
DeepHyperX, Swin-Transformer, Swin-MAE, SpectralFormer, MAEST, morphFormer