This is a code demo for the paper "Few-shot Hyperspectral Image Classification with Self-supervised Learning" Zhaokui Li, Hui Guo, Yushi Chen, Cuiwei Liu, Qian Du, Zhuoqun Fang, and Yan Wang, Few-shot Hyperspectral Image Classification with Self-supervised Learning, IEEE Transactions on Geoscience and Remote Sensing.
- CUDA = 11.1
- Python = 3.9
- Pytorch = 1.8.0
- sklearn = 1.0.1
- numpy = 1.21.2
You can download the hyperspectral datasets in mat format at: http://www.ehu.eus/ccwintco/index.php/Hyperspectral_Remote_Sensing_Scenes, and move the files to ./datasets
folder.
You can download the WHU-Hi-HanChuan hyperspectral dataset from the following link.
Link: https://pan.baidu.com/s/1IfHYp-WL6dDDpjO1AU_Law?pwd=b63e
Extract code:b63e
The mini-ImageNet data sets can be downloaded from the following link: Link: https://pan.baidu.com/s/1Mn1en9EhfFvE-i62YnbwhQ Extract code: 54DO
An example dataset folder has the following structure:
datasets
├── IP
│ ├── indian_pines_corrected.mat
│ ├── indian_pines_gt.mat
└── paviaU
│ ├── paviaU.mat
│ ├── paviaU_gt.mat
└── HC
│ ├── WHU_Hi_HanChuan.mat
│ ├── WHU_Hi_HanChuan(15%)_gt.mat
└── Salinas
│ ├── Salinas_corrected.mat
│ ├── salinas_gt.mat
└── miniImagenet
│ ├──
│ ├──
Take FSCF-SSL method :
- Download the required data set and move to folder
./datasets
. - To run the file, you need to download the VGG pre-training weights file (vgg16_bn-6c64b313.pth). The VGG pre-training weight file can be downloadfrom the following link: Link: https://pan.baidu.com/s/1iOYOaiWXibaaIpapb_GFsQ Extract code:0tdu
- Taking 5 labeled samples per class as an example, run
FSCF-SSL.py