MCPcopy Index your code
hub / github.com/HSG-AIML/MaskedSST

github.com/HSG-AIML/MaskedSST @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
247 symbols 658 edges 19 files 45 documented · 18%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Masked Vision Transformers for Hyperspectral Image Classification

This projects tailors vision transformers to the characteristics of hyperspectral aerial and satellite imagery using: (i) blockwise patch embeddings (ii) spatial-spectral self-attention, (iii) spectral positional embeddings and (iv) masked self-supervised pre-training.

Results were presented at the CVPR EarthVision Workshop 2023, Paper Link.

Masked pre-training

The masked pre-training can be started with a call to the pretrain.py file. Before starting the training, make sure to adjust the paths to your local copy of the dataset in configs/config.yaml. Hyperparameters can be adjusted in configs/pretrain_config.yaml.

Land-cover Classification

The finetune.py script can be used to finetune a pre-trained model or to train a model from scratch for classifcation of EnMAP or Houston2018 data. The desired dataset must be provided as argument, e.g., finetune.py enmap. Prior to training, the dataset paths must be specified in configs/config.yaml. Hyperparameters can be adjusted in configs/finetune_config_{dataset}.yaml. There is also an alternative fine-tuning script for the use with wandb sweep functionality at src/finetune_sweep.py.

Data

  • The Houston2018 dataset is publicly available from the Hyperspectral Image Analysis Lab at the University of Houston and IEEE GRSS IADF.
  • Code to re-create the unlabeled EnMAP and labeled EnMAP-DFC datasets is made available in the enmap_data directory. Please follow the instructions there.

Pre-trained checkpoints

We provide the pre-trained model checkpoints for the spatial-spectral transformer on Houston2018 and EnMAP datasets. * Houston2018 checkpoint * EnMAP checkpoint

Code

This repository was developed using Python 3.8.13 with PyTorch 1.12. Please have a look at the requirements.txt file for more details.

It incorporates code from the following source for the 3D-CNN model of Li et al. (Remote Sensing, 2017) * DeepHyperX

The vision transformer and SimMIM implementations are adapted from: * vit-pytorch

Reference

If you would like to cite our work, please use the following reference:

  • Scheibenreif, L., Mommert, M., & Borth, D. (2023). Masked Vision Transformers for Hyperspectral Image Classification, In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops (CVPRW) 2023
@inproceedings{scheibenreif2023masked,
  title={Masked vision transformers for hyperspectral image classification},
  author={Scheibenreif, Linus and Mommert, Michael and Borth, Damian},
  booktitle={Proceedings of the IEEE/CVF conference on computer vision and pattern recognition},
  pages={2166--2176},
  year={2023}
}

Core symbols most depended-on inside this repo

open_file
called by 19
DeepHyperX/utils.py
pair
called by 6
src/vit_spatial_spectral.py
save_model
called by 5
DeepHyperX/models.py
convert_to_color
called by 5
DeepHyperX/main.py
transformer_forward
called by 4
src/vit_spatial_spectral.py
build_dataset
called by 4
DeepHyperX/utils.py
get_model
called by 4
DeepHyperX/models.py
load_img
called by 3
src/data_enmap.py

Shape

Method 145
Function 53
Class 49

Languages

Python100%

Modules by API surface

DeepHyperX/models.py62 symbols
src/vit_spatial_spectral.py53 symbols
src/data_enmap.py32 symbols
DeepHyperX/utils.py19 symbols
src/vit_original.py16 symbols
src/vit_simmim_original.py15 symbols
src/utils.py15 symbols
src/data_houston2018.py13 symbols
DeepHyperX/datasets.py10 symbols
src/pos_embed.py5 symbols
enmap_data/create_enmap_dfc_dataset.py2 symbols
DeepHyperX/main.py2 symbols

For agents

$ claude mcp add MaskedSST \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact