• Stars
    star
    260
  • Rank 156,246 (Top 4 %)
  • Language
    Python
  • License
    MIT License
  • Created over 2 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Remote Sensing Change Detection using Denoising Diffusion Probabilistic Models

DDPM-CD: Remote Sensing Change Detection using Denoising Diffusion Probabilistic Models

Paper | Project

This is the offical Pytorch implementation of Remote Sensing Change Detection using Denoising Diffusion Probabilistic Models.

▢️Motivation

image-20210228153142126 Images generated from the diffusion model trained on off-the-shelf remote sensing images. The generated images contain objects that we commonly see in real remote sensing images, such as buildings, trees, roads, vegetation, water surfaces, etc., demonstrating the powerful ability of the diffusion models to extract key semantics that can be further used in remote sensing change detection.

▢️Method

image-20210228153142126 We fine-tune a light-weight change detection head which takes multi-level feature representations from the pre-trained diffusion model as inputs and outputs change prediction map.

▢️Environment

conda create -n ddpm-cd python=3.9
conda activate ddpm-cd
pip3 install -r requirement.txt

▢️Training diffusion model with remote sensing data

πŸ”…Collect off-the-shelf remote sensing data to train diffusion model

Dump all the remote sensing data sampled from Google Earth Engine and any other publically available remote sensing images to dataset folder or create a simlink.

πŸ”…Training/Resume unconditional diffusion model on remote sensing data

We use ddpm_train.json to setup the configurations. Update the dataset name and dataroot in the json file. Then run the following command to start training the diffusion model. The results and log files will be save to experiments folder. Also, we upload all the metrics to wandb.

python ddpm_train.py --config config/ddpm_train.json -enable_wandb -log_eval

In case, if you want to resume the training from previosely saved point, provide the path to saved model in path/resume_state, else keep it as null.

πŸ”…Sampling from the diffusion model

If you want generate samples from the diffusion model, first update the path to trained diffusion model in [path][resume_state]. Then run the following command.

python ddpm_train.py --config config/ddpm_sampling.json --phase val

The generated images will be saved in experiments.

▢️Change Detection

πŸ”…Download the datasets

Download the change detection datasets from the following links. Place them inside your datasets folder.

Then, update the paths to those folders here [datasets][train][dataroot], [datasets][val][dataroot], [datasets][test][dataroot] in levir.json, whu.json, dsifn.json, and cdd.json.

Provide the path to pre-trained diffusion model

Udate the path to pre-trained diffusion model weights (*_gen.pth and *_opt.pth) here [path][resume_state] in levir.json, whu.json, dsifn.json, and cdd.json..

πŸ”…Training the change detection network

Run the following code to start the training.

  • Training on LEVIR-CD:
    python ddpm_cd.py --config config/levir.json -enable_wandb -log_eval
  • Training on WHU-CD:
    python ddpm_cd.py --config config/whu.json -enable_wandb -log_eval
  • Training on DSIFN-CD:
    python ddpm_cd.py --config config/dsifn.json -enable_wandb -log_eval
  • Training on CDD:
    python ddpm_cd.py --config config/cdd.json -enable_wandb -log_eval

The results will be saved in experiments and also upload to wandb.

πŸ”…Testing

To obtain the predictions and performance metrics (iou, f1, and OA), first provide the path to pre-trained diffusion model here [path][resume_state] and path to trained change detection model (the best model) here [path_cd][resume_state] in levir_test.json, whu_test.json, dsifn_test.json, and cdd_test.json.

Run the following code to start the training.

  • Test on LEVIR-CD:
    python ddpm_cd.py --config config/levir_test.json --phase test -enable_wandb -log_eval
  • Test on WHU-CD:
    python ddpm_cd.py --config config/whu_test.json --phase test -enable_wandb -log_eval
  • Test on DSIFN-CD:
    python ddpm_cd.py --config config/dsifn_test.json --phase test -enable_wandb -log_eval
  • Test on CDD:
    python ddpm_cd.py --config config/cdd_test.json --phase test -enable_wandb -log_eval

Predictions will be saved in experiments and performance metrics will be uploaded to wandb.

▢️Pre-trained models & Train/Val/Test logs

πŸ”…Links to download pre-trained models

πŸ’₯ If you face a problem when downloading from the DropBox try one of the following options:

πŸ”…Train/Val Reports on wandb

πŸ”…Test results on wandb

▢️Results

πŸ”…Quantitative

image-20210228153142126

πŸ”…Qualitative

  • LEVIR-CD image-20210228153142126
  • WHU-CD image-20210228153142126
  • DSIFN-CD image-20210228153142126
  • CDD image-20210228153142126

▢️Citation

@misc{https://doi.org/10.48550/arxiv.2206.11892,
  doi = {10.48550/ARXIV.2206.11892},
  
  url = {https://arxiv.org/abs/2206.11892},
  
  author = {Bandara, Wele Gedara Chaminda and Nair, Nithin Gopalakrishnan and Patel, Vishal M.},
  
  keywords = {Computer Vision and Pattern Recognition (cs.CV), Machine Learning (cs.LG), FOS: Computer and information sciences, FOS: Computer and information sciences},
  
  title = {Remote Sensing Change Detection (Segmentation) using Denoising Diffusion Probabilistic Models},
  
  publisher = {arXiv},
  
  year = {2022},
  
  copyright = {Creative Commons Attribution 4.0 International}
}

▢️References

  • The code of diffusion model is from here.

More Repositories

1

ChangeFormer

[IGARSS'22]: A Transformer-Based Siamese Network for Change Detection
Python
399
star
2

HyperTransformer

[CVPR'22] HyperTransformer: A Textural and Spectral Feature Fusion Transformer for Pansharpening
Python
124
star
3

SemiCD

Revisiting Consistency Regularization for Semi-supervised Change Detection in Remote Sensing Images
Python
120
star
4

SPIN_RoadMapper

Official implementation of our ICRA'22 paper: SPIN Road Mapper: Extracting Roads from Aerial Images via Spatial and Interaction Space Graph Reasoning for Autonomous Driving
Jupyter Notebook
79
star
5

adamae

[CVPR'23] AdaMAE: Adaptive Masking for Efficient Spatiotemporal Learning with Masked Autoencoders
Python
65
star
6

DIP-HyperKite

[IEEE TGRS] DIP-HyperKite: Hyperspectral Pansharpening Based on Improved Deep Image Prior and Residual Reconstruction
Python
56
star
7

Metric-CD

Official PyTorch implementation of Deep Metric Learning for Unsupervised Change Detection in Remote Sensing Images
Jupyter Notebook
15
star
8

mix-bt

Official PyTorch Implementation of Guarding Barlow Twins Against Overfitting with Mixed Samples
Python
13
star
9

apt

PyTorch Implementation of Attention Prompt Tuning: Parameter-Efficient Adaptation of Pre-Trained Models for Action Recognition
Python
13
star
10

CD-SOTA-methods

Remote sensing change detection: state of the art methods and datasets
6
star
11

Complete_State-Estimation_Algorithm

A Complete State Estimation Algorithm for a Three-Phase Four-Wire Low Voltage Distribution System with High Penetration of Solar PV
Jupyter Notebook
5
star
12

DiffuseDenoiseCount

Python
1
star