Spaces:
Running on Zero
Running on Zero
File size: 4,128 Bytes
790be00 5350305 790be00 0ea6e8a d43892c 0ea6e8a d43892c 0ea6e8a 2522177 0ea6e8a 2522177 0ea6e8a d43892c 0ea6e8a d43892c 0ea6e8a d43892c 0ea6e8a d43892c 0ea6e8a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | ---
title: Aftermath
emoji: 🛰️
colorFrom: blue
colorTo: indigo
sdk: gradio
app_file: app.py
pinned: false
---
# Remote Sensing Image Change Detection with Transformers
Here, we provide the pytorch implementation of the paper: Remote Sensing Image Change Detection with Transformers.
For more ore information, please see our published paper at [IEEE TGRS](https://ieeexplore.ieee.org/document/9491802) or [arxiv](https://arxiv.org/abs/2103.00208).

## Requirements
```
Python 3.6
pytorch 1.6.0
torchvision 0.7.0
einops 0.3.0
```
## Installation
Clone this repo:
```shell
git clone https://github.com/justchenhao/BIT_CD.git
cd BIT_CD
```
## Quick Start
We have some samples from the [LEVIR-CD](https://justchenhao.github.io/LEVIR/) dataset in the folder `samples` for a quick start.
Firstly, you can download our BIT pretrained model——by [baidu drive, code: 2lyz](https://pan.baidu.com/s/1HiXwpspl6odYQKda6pMuZQ) or [google drive](https://drive.google.com/file/d/1IVdF5a3e1_7DiSndtMkhpZuCSgDLLFcg/view?usp=sharing). After downloaded the pretrained model, you can put it in `checkpoints/BIT_LEVIR/`.
Then, run a demo to get started as follows:
```python
python demo.py
```
After that, you can find the prediction results in `samples/predict`.
## Train
You can find the training script `run_cd.sh` in the folder `scripts`. You can run the script file by `sh scripts/run_cd.sh` in the command environment.
The detailed script file `run_cd.sh` is as follows:
```cmd
gpus=0
checkpoint_root=checkpoints
data_name=LEVIR # dataset name
img_size=256
batch_size=8
lr=0.01
max_epochs=200 #training epochs
net_G=base_transformer_pos_s4_dd8 # model name
#base_resnet18
#base_transformer_pos_s4_dd8
#base_transformer_pos_s4_dd8_dedim8
lr_policy=linear
split=train # training txt
split_val=val #validation txt
project_name=CD_${net_G}_${data_name}_b${batch_size}_lr${lr}_${split}_${split_val}_${max_epochs}_${lr_policy}
python main_cd.py --img_size ${img_size} --checkpoint_root ${checkpoint_root} --lr_policy ${lr_policy} --split ${split} --split_val ${split_val} --net_G ${net_G} --gpu_ids ${gpus} --max_epochs ${max_epochs} --project_name ${project_name} --batch_size ${batch_size} --data_name ${data_name} --lr ${lr}
```
## Evaluate
You can find the evaluation script `eval.sh` in the folder `scripts`. You can run the script file by `sh scripts/eval.sh` in the command environment.
The detailed script file `eval.sh` is as follows:
```cmd
gpus=0
data_name=LEVIR # dataset name
net_G=base_transformer_pos_s4_dd8_dedim8 # model name
split=test # test.txt
project_name=BIT_LEVIR # the name of the subfolder in the checkpoints folder
checkpoint_name=best_ckpt.pt # the name of evaluated model file
python eval_cd.py --split ${split} --net_G ${net_G} --checkpoint_name ${checkpoint_name} --gpu_ids ${gpus} --project_name ${project_name} --data_name ${data_name}
```
## Dataset Preparation
### Data structure
```
"""
Change detection data set with pixel-level binary labels;
├─A
├─B
├─label
└─list
"""
```
`A`: images of t1 phase;
`B`:images of t2 phase;
`label`: label maps;
`list`: contains `train.txt, val.txt and test.txt`, each file records the image names (XXX.png) in the change detection dataset.
### Data Download
LEVIR-CD: https://justchenhao.github.io/LEVIR/
WHU-CD: https://study.rsgis.whu.edu.cn/pages/download/building_dataset.html
DSIFN-CD: https://github.com/GeoZcx/A-deeply-supervised-image-fusion-network-for-change-detection-in-remote-sensing-images/tree/master/dataset
## License
Code is released for non-commercial and research purposes **only**. For commercial purposes, please contact the authors.
## Citation
If you use this code for your research, please cite our paper:
```
@Article{chen2021a,
title={Remote Sensing Image Change Detection with Transformers},
author={Hao Chen, Zipeng Qi and Zhenwei Shi},
year={2021},
journal={IEEE Transactions on Geoscience and Remote Sensing},
volume={},
number={},
pages={1-14},
doi={10.1109/TGRS.2021.3095166}
}
```
|