Home

Awesome

Change Detection Laboratory

Yet another project for developing and benchmarking deep learning-based remote sensing change detection methods.

CDLab also has a PaddlePaddle version.

English | 简体中文

News

Prerequisites

opencv-python==4.1.1
pytorch==1.6.0
torchvision==0.7.0
pyyaml==5.1.2
scikit-image==0.15.0
scikit-learn==0.21.3
scipy==1.3.1
tqdm==4.35.0

Tested using Python 3.7.4 on Ubuntu 16.04.

Get Started

In src/constants.py, change the dataset locations to your own.

Data Preprocessing

In scripts/ there are preprocessing scripts for several datasets。

Model Training

To train a model from scratch, use

python train.py train --exp_config PATH_TO_CONFIG_FILE

A few configuration files regarding different datasets and models are provided in the configs/ folder for ease of use. Note that the hyperparameters are not elaborately investigated to obtain a fully optimized performance.

As soon as the program starts and prints out the configurations, there will be a prompt asking you to write some notes. What you write will be recorded into the log file to help you remember what you did, or you can simply skip this step by pressing [Enter].

To resume training from some checkpoint, run the code with the --resume option.

python train.py train --exp_config PATH_TO_CONFIG_FILE --resume PATH_TO_CHECKPOINT

Other frequently used commandline options include:

During or after the training process, you can check the model weight files in exp/DATASET_NAME/weights/, the log files in exp/DATASET_NAME/logs/, and the output change maps in exp/DATASET_NAME/out/.

Model Evaluation

To evaluate a model on the test subset, use

python train.py eval --exp_config PATH_TO_CONFIG_FILE --resume PATH_TO_CHECKPOINT --save_on --subset test

This project also provides the funtionality of sliding-window test on large raster images. Use the following command:

python sw_test.py --exp_config PATH_TO_CONFIG_FILE \
  --resume PATH_TO_CHECKPOINT --ckp_path PATH_TO_CHECKPOINT \
  --t1_dir PATH_TO_T1_DIR --t2_dir PATH_TO_T2_DIR --gt_dir PATH_TO_GT_DIR

Other frequently used commandline options of src/sw_test.py include:

Note however that currently src/sw_test.py does not support custom pre-processing or post-processing modules.

Use Models from Third-Party Libraries

Currently this projects supports the training and evaluation of models from the change_detection.pytorch library, which can be achieved by simply modifying the configuration files. Please refer to the example in configs/svcd/config_svcd_cdp_unet.yaml

The version number of the supported change_detection.pytorch library is 0.1.0.

Supported Models

ModelNameLink
CDNetCDNetpaper
FC-EFUNetpaper
FC-Siam-concSiamUNet-concpaper
FC-Siam-diffSiamUNet-diffpaper
STANetSTANetpaper
DSIFNIFNpaper
SNUNetSNUNetpaper
BITBITpaper
L-UNetLUNetpaper
DSAMNetDSAMNetpaper
P2V-CDP2Vpaper

Supported Datasets

DatasetNameLink
Synthetic images and real season-varying remote sensing imagesSVCDgoogle drive
WHU building change detection datasetWHUwebsite
LEVIR building change detection datasetLEVIRCDwebsite

Performance on SVCD Dataset

ModelPrecisionRecallF1OA
CDNet92.9987.0889.9497.59
FC-EF94.2883.8088.7397.37
FC-Siam-conc94.5791.3492.9398.28
FC-Siam-diff95.8790.6093.1698.36
STANet89.2298.2593.5298.32
DSIFN97.6496.3596.9999.26
SNUNet97.8997.2597.5799.40
BIT97.2096.3896.7999.21
L-UNet96.4894.7995.6398.93
DSAMNet92.7898.0695.3598.82
P2V-CD98.5798.2698.42

License

This project is released under the Unlicense.

Contributing

Any kind of contributions to improve this repository is welcome.