InPeerReview's picture
Update README.md
fdf17f8 verified
## Requirements
### πŸ› οΈEnvironment
- Python 3.8+
- PyTorch 2.0.1+
- CUDA 11.8+
- Ubuntu 22.04 or higher / Windows 10
### πŸ› οΈInstallation
```bash
conda create --name rscd python=3.8
conda activate rscd
conda install pytorch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2 pytorch-cuda=11.8 -c pytorch -c nvidia
pip install pytorch-lightning==2.0.5
pip install scikit-image==0.19.3 numpy==1.24.4
pip install torchmetrics==1.0.1
pip install -U catalyst==20.09
pip install albumentations==1.3.1
pip install einops==0.6.1
pip install timm==0.6.7
pip install addict==2.4.0
pip install soundfile==0.12.1
pip install ttach==0.0.3
pip install prettytable==3.8.0
pip install -U openmim
pip install triton==2.0.0
mim install mmcv
pip install -U fvcore
cd rscd/models/backbones/lib_mamba/kernels/selective_scan && pip install .
```
### πŸ“Dataset Preparation
We evaluate our method on three public datasets: **LEVIR-CD**, **WHU-CD**, and **CLCD**.
| Dataset | Link |
|-----------|------|
| LEVIR-CD | [Download](https://drive.google.com/file/d/1MEKc9UTM3j4zPFfkvFvjjsynGjZ5tRrF/view?usp=drive_link) |
| WHU-CD | [Download](https://drive.google.com/file/d/1N73eO20hjtEyYd33M6119U03DYkHjm5i/view?usp=drive_link) |
| CLCD | [Download](https://drive.google.com/file/d/19eW-Yad3SSiQNuB8WT5XOnvPvjxCp1Cz/view?usp=drive_link) |
```bash
Please organize the datasets as follows:
rschangedetection
β”œβ”€β”€ rscd (code)
β”œβ”€β”€ work_dirs (save the model weights and training logs)
β”‚ └─CLCD_BS4_epoch200 (dataset)
β”‚ └─stnet (model)
β”‚ └─version_0 (version)
β”‚ β”‚ └─ckpts
β”‚ β”‚ β”œβ”€test (the best ckpts in test set)
β”‚ β”‚ └─val (the best ckpts in validation set)
β”‚ β”œβ”€log (tensorboard logs)
β”‚ β”œβ”€train_metrics.txt (train & val results per epoch)
β”‚ β”œβ”€test_metrics_max.txt (the best test results)
β”‚ └─test_metrics_rest.txt (other test results)
└── data
β”œβ”€β”€ LEVIR_CD
β”‚ β”œβ”€β”€ train
β”‚ β”‚ β”œβ”€β”€ A
β”‚ β”‚ β”‚ └── images1.png
β”‚ β”‚ β”œβ”€β”€ B
β”‚ β”‚ β”‚ └── images2.png
β”‚ β”‚ └── label
β”‚ β”‚ └── label.png
β”‚ β”œβ”€β”€ val (the same with train)
β”‚ └── test(the same with train)
β”œβ”€β”€ WHU_CD
β”‚ β”œβ”€β”€ train
β”‚ β”‚ β”œβ”€β”€ image1
β”‚ β”‚ β”‚ └── images1.png
β”‚ β”‚ β”œβ”€β”€ image2
β”‚ β”‚ β”‚ └── images2.png
β”‚ β”‚ └── label
β”‚ β”‚ └── label.png
β”‚ β”œβ”€β”€ val (the same with train)
β”‚ └── test(the same with train)
└── CLCD (the same with WHU_CD)
```
### πŸš€Use example
Training
```bash
python train.py -c configs/mamba_cttf.py
```
Testing
```bash
python test.py \
-c configs/mamba_cttf.py \
--ckpt work_dirs/CLCD_BS4_epoch200/mamba_cttf/version_0/ckpts/test/epoch=156.ckpt \
--output_dir work_dirs/CLCD_BS4_epoch200/mamba_cttf/version_0/ckpts/test \
```
Count params and flops
```bash
python tools/params_flops.py --size 256
```
### πŸ’‘Acknowledgement
Thanks to previous open-sourced repo:
- [mmsegmentation](https://github.com/open-mmlab/mmsegmentation)
- [pytorch lightning](https://github.com/Lightning-AI/lightning)
- [fvcore](https://github.com/facebookresearch/fvcore)