Giter Club home page Giter Club logo

cdfs-cascl-2024's Introduction

CDFS-CASCL-2024

This is a code demo for the paper "Cross-Domain Few-shot Hyperspectral Image Classification with Cross-Modal Alignment and Supervised Contrastive Learning".

Requirements

  • CUDA = 12.2

  • python = 3.9.18

  • torch = 1.11.0+cu113

  • transformers = 4.30.2

  • sklearn = 0.0.post9

  • numpy = 1.26.0

Datasets

  • source domain dataset

    • Chikusei
  • target domain datasets

    • Indian Pines
    • Houston
    • Salinas
    • WHU-Hi-LongKou

You can download the source and target datasets mentioned above at https://pan.baidu.com/s/1wo9xj85YaT3JGogVyJKZTQ?pwd=5lkl, and move to folder datasets. In particular, for the source dataset Chikusei, you can choose to download it in mat format, and then use the utils/chikusei_imdb_128.py file to process it to get the patch size you want, or directly use the preprocessed source dataset Chikusei_imdb_128_7_7.pickle with a patch size of 7 $\times$ 7. In addition, for the Houston dataset in the target domain, since it has officially divided training and test sets, the data loading part is slightly different from the other three datasets. We only take k samples of each class from the training set for training, and the samples of the test set are used for testing. For this reason, we specially uploaded train-HT.py and related data loading code.

An example datasets folder has the following structure:

datasets
├── Chikusei_imdb_128_7_7.pickle
├── Chikusei_raw_mat
│   ├── HyperspecVNIR_Chikusei_20140729.mat
│   └── HyperspecVNIR_Chikusei_20140729_Ground_Truth.mat
├── IP
│   ├── indian_pines_corrected.mat
│   └── indian_pines_gt.mat
├── Houston
│   ├── data.mat
│   ├── mask_train.mat
│   └── mask_test.mat
├── salinas
│   ├── salinas_corrected.mat
│   └── salinas_gt.mat
└── WHU-Hi-LongKou
    ├── WHU_Hi_LongKou.mat
    └── WHU_Hi_LongKou_gt.mat

Pretrain model

You can download the pre-trained model of Base Bert, bert-base-uncased, at https://pan.baidu.com/s/1C6qExEcVd3foNtLcn7PKFw?pwd=enda, and move to folder pretrain-model.

An example pretrain-model folder has the following structure:

pretrain-model
└── bert-base-uncased
    ├── config.json
    ├── pytorch_model.bin
    ├── tokenizer.json
    ├── tokenizer_config.json
    └── vocab.txt

Usage

  1. Download the required source and target datasets and move to folder datasets.
  • If you down the source domain dataset (Chikusei) in mat format, you need to run the script Chikusei_imdb_128.py to generate preprocessed source domain data.
  • If you downloaded Chikusei_imdb_128_7_7.pickle, move it directly to the corresponding dataset directory.
  1. Download the required Base Bert pre-trained model and move to folder pretrain-model.
  2. Run train.py.

cdfs-cascl-2024's People

Contributors

li-zk avatar

Stargazers

Felix avatar Felipe avatar  avatar mofan avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

movan58 venonary

cdfs-cascl-2024's Issues

Houston dataset

Regarding the training code for the Houston dataset, how should the dataset be loaded? Why is it that other datasets typically consist of two files, while the Houston dataset has been processed into three files?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.