| ## 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) |
|
|