YAML Metadata
Warning:
empty or missing yaml metadata in repo card
(https://huggingface.co/docs/hub/model-cards#model-card-metadata)
π οΈ Requirements
Environment
- Linux system, Windows is not tested, depending on whether and can be installed
causal-conv1dandmamba-ssm - Python 3.8+, recommended 3.10
- PyTorch 2.0 or higher, recommended 2.1.0
- CUDA 11.7 or higher, recommended 12.1
Environment Installation
It is recommended to use Miniconda for installation. The following commands will create a virtual environment named stnr and install PyTorch. In the following installation steps, the default installed CUDA version is 12.1. If your CUDA version is not 12.1, please modify it according to the actual situation.
# Create conda environment
conda create -n stnr python=3.8 -y
conda activate stnr
# Install PyTorch
pip install torch==2.1.0 torchvision==0.14.0 torchaudio==0.13.0
# Install dependencies
pip install causal_conv1d mamba_ssm packaging
pip install timm==0.4.12
pip install pytest chardet yacs termcolor
pip install submitit tensorboardX
pip install triton==2.0.0
# Or simply run
pip install -r requirements.txt
π Dataset Preparation
We evaluate our method on five remote sensing change detection datasets: WHU-CD, LEVIR-CD, LEVIR-CD+, SYSU-CD, and SVCD.
Please organize the datasets as follows:
${DATASET_ROOT} # Dataset root directory, for example: /home/username/data/LEVIR-CD
βββ A
β βββ train_1_1.png
β βββ train_1_2.png
β βββ...
β βββ val_1_1.png
β βββ val_1_2.png
β βββ...
β βββ test_1_1.png
β βββ test_1_2.png
β βββ ...
βββ B
β βββ train_1_1.png
β βββ train_1_2.png
β βββ...
β βββ val_1_1.png
β βββ val_1_2.png
β βββ...
β βββ test_1_1.png
β βββ test_1_2.png
β βββ ...
βββ label
β βββ train_1_1.png
β βββ train_1_2.png
β βββ...
β βββ val_1_1.png
β βββ val_1_2.png
β βββ...
β βββ test_1_1.png
β βββ test_1_2.png
β βββ ...
βββ list
β βββ train.txt
β βββ val.txt
β βββ test.txt
π§ Model Training and Testing
All configuration for model training and testing is stored in the local folder config. Below are the example commands to train and test the model on the LEVIR-CD dataset.
Example of Training on LEVIR-CD Dataset
python train_cd.py --config/levir/levir.json
Example of Training on LEVIR-CD Dataset
python test_cd.py --config/levir/levir_test.json
π Project Structure
STNR-Det/
βββ config/ # Configuration files for training/testing
β βββ levir_cd_mamba.json
β βββ levir_test_cd_mamba.json
β βββ ...
βββ core/ # Core functionality (e.g., models, loss functions)
β βββ ...
βββ data/ # Data loading and preprocessing scripts
β βββ ...
βββ misc/ # Miscellaneous utility scripts
β βββ ...
βββ models/ # Model architectures and components
β βββ ...
βββ .gitattributes # Git attributes for version control
βββ README.md # Project README (this file)
βββ requirement.txt # Python package dependencies
βββ test_cd.py # Testing script for the model
βββ train_cd.py # Training script for the model
π Acknowledgement
We sincerely thank the following works for their contributions:
- CDMamba β A state-of-the-art method for remote sensing change detection that inspired and influenced parts of this work.
- MambaDFuse β A valuable method for feature fusion that informed our approach.
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
π
Ask for provider support