CSSM
Efficient Remote Sensing Change Detection with Change State Space Models
Faculty of Engineering and Natural Sciences (VPALab), Sabanci University, Istanbul, Turkiye
🛎️Updates
Notice🐍🐍 : CSSM has been accepted by IEEE GRSL ! We'd appreciate it if you could give this repo a ⭐️star ⭐️ and stay tuned!!
Nov 05th, 2025 : The CSSM model and training code uploaded. You are welcome to use them!!
🚀 Overview
CSSM serves as an efficient and state-of-the-art (SOTA) benchmark for binary change detection.
Screenshot from 2025-11-03 16-28-31
📦 Requirements
1
2 pip install torch torchvision torchaudio
3 pip install pillow
4 pip install numpy scipy pandas
5 pip install matplotlib seaborn
6 pip install einops
7 pip install torchinfo
8
📁 Dataset Preparation
This project supports three main change detection datasets:
LEVIR-CD+ - Download
SYSU-CD - Download
WHU-CD - Download
Dataset Structure
For LEVIR-CD:
your_dataset/
├── train/
│ ├── A/ # Pre-change images
│ ├── B/ # Post-change images
│ └── label/ # Ground truth masks
├── test/
│ ├── A/
│ ├── B/
│ └── label/
└── val/
├── A/
├── B/
└── label/
For SYSU-CD:
your_dataset/
├── train/
│ ├── time1/ # Pre-change images
│ ├── time2/ # Post-change images
│ └── label/ # Ground truth masks
├── test/
│ ├── time1/
│ ├── time2/
│ └── label/
└── val/
├── time1/
├── time2/
└── label/
For WHU-CD:
WHU-CD/
├── A/ # Pre-change images
├── B/ # Post-change images
├── label/ # Ground truth masks
├── train_list.txt # List of training samples
├── test_list.txt # List of test samples
└── val_list.txt # List of validation samples
The text files should contain image names (one per line):
image_001.png
image_002.png
image_003.png
...
🚂 Training
LEVIR-CD Dataset
1 python main.py \
2 --dataset levir \
3 --train_path /path/to/LEVIR-CD/train \
4 --test_path /path/to/LEVIR-CD/test \
5 --val_path /path/to/LEVIR-CD/val \
6 --batch_size 64 \
7 --epochs 50 \
8 --lr 0.001
SYSU-CD Dataset
1 python main.py \
2 --dataset sysu \
3 --train_path /path/to/SYSU-CD/train \
4 --test_path /path/to/SYSU-CD/test \
5 --val_path /path/to/SYSU-CD/val \
6 --batch_size 32 \
7 --epochs 100 \
8 --lr 0.0001
WHU-CD Dataset
1 python main.py \
2 --dataset whu \
3 --train_path /path/to/WHU-CD \
4 --train_txt /path/to/train_list.txt \
5 --test_txt /path/to/test_list.txt \
6 --val_txt /path/to/val_list.txt \
7 --batch_size 64 \
8 --epochs 50
⚙️ Arguments
Required Arguments
Argument Description Example --datasetDataset type: levir, sysu, or whu --dataset levir--train_pathPath to training data --train_path /data/train--test_pathPath to test data (not for WHU) --test_path /data/test--val_pathPath to validation data (not for WHU) --val_path /data/val
WHU-CD Specific Arguments
Argument Description Example --train_txtTraining sample list file --train_txt train_list.txt--test_txtTest sample list file --test_txt test_list.txt--val_txtValidation sample list file --val_txt val_list.txt
Optional Arguments
Argument Default Description --batch_size64 Batch size for training --epochs50 Number of training epochs --lr0.001 Learning rate --step_size10 Learning rate scheduler step size --save_dir./checkpoints Directory to save model checkpoints --model_namebest_model.pth Filename for saved model --seed42 Random seed for reproducibility --num_workers4 Number of data loading workers
🔧 Advanced Usage Examples
Custom Save Directory and Model Name
1 python main.py \
2 --dataset levir \
3 --train_path /data/LEVIR-CD/train \
4 --test_path /data/LEVIR-CD/test \
5 --val_path /data/LEVIR-CD/val \
6 --save_dir ./experiments/levir_exp1 \
7 --model_name levir_model.pth \
8 --epochs 100
Different Learning Rate Schedule
1 python main.py \
2 --dataset sysu \
3 --train_path /data/SYSU-CD/train \
4 --test_path /data/SYSU-CD/test \
5 --val_path /data/SYSU-CD/val \
6 --lr 0.0005 \
7 --step_size 20 \
8 --epochs 150
Smaller Batch Size (for limited GPU memory)
1 python main.py \
2 --dataset levir \
3 --train_path /data/train \
4 --test_path /data/test \
5 --val_path /data/val \
6 --batch_size 16 \
7 --num_workers 2
📤 Output
During training, the script will:
Display training loss for each batch
Show validation metrics (IoU, confusion matrix) after each epoch
Save the best model based on validation IoU
Display learning rate and epoch time
Model Checkpoint
The best model is automatically saved to:
Default: ./checkpoints/best_model.pth
🔍 Troubleshooting
Paths with Spaces
If your paths contain spaces, wrap them in quotes:
1 python main.py \
2 --dataset levir \
3 --train_path "/path/with spaces/train" \
4 --test_path "/path/with spaces/test" \
5 --val_path "/path/with spaces/val"
CUDA Out of Memory
Reduce batch size:
python main.py --dataset levir ... --batch_size 16
Missing WHU Text Files
For WHU dataset, ensure all three text files are provided:
1 python main.py \
2 --dataset whu \
3 --train_path /data/WHU-CD \
4 --train_txt train_list.txt \
5 --test_txt test_list.txt \
6 --val_txt val_list.txt
💡 Getting Help
View all available arguments:
📧 Contact
If you have any questions, please contact Elman Ghazaei at
elman.ghazaei@sabanciuniv.edu
Qualitative Analysis:
Screenshot from 2025-11-03 16-38-52
Results
Screenshot from 2025-11-03 18-02-18