All Projects → wgcban → ChangeFormer

wgcban / ChangeFormer

Licence: other
Official PyTorch implementation of our IGARSS'22 paper: A Transformer-Based Siamese Network for Change Detection

Programming Languages

python
139335 projects - #7 most used programming language
shell
77523 projects
matlab
3953 projects

Projects that are alternatives of or similar to ChangeFormer

FDCNN
The implementation of FDCNN in paper - A Feature Difference Convolutional Neural Network-Based Change Detection Method
Stars: ✭ 54 (-75.45%)
Mutual labels:  remote-sensing, siamese-network, change-detection
3D-PV-Locator
Repo for "3D-PV-Locator: Large-scale detection of rooftop-mounted photovoltaic systems in 3D" based on Applied Energy publication.
Stars: ✭ 35 (-84.09%)
Mutual labels:  remote-sensing, satellite-imagery, climate-change
ChangeDetectionRepository
This repository contains some python code of some traditional change detection methods or provides their original websites, such as SFA, MAD, and some deep learning-based change detection methods, such as SiamCRNN, DSFA, and some FCN-based methods.
Stars: ✭ 311 (+41.36%)
Mutual labels:  remote-sensing, change-detection, multi-temporal
Notebooks
interactive notebooks from Planet Engineering
Stars: ✭ 339 (+54.09%)
Mutual labels:  remote-sensing, satellite-imagery
shipsnet-detector
Detect container ships in Planet imagery using machine learning
Stars: ✭ 30 (-86.36%)
Mutual labels:  remote-sensing, satellite-imagery
Torchsat
🔥TorchSat 🌏 is an open-source deep learning framework for satellite imagery analysis based on PyTorch.
Stars: ✭ 261 (+18.64%)
Mutual labels:  remote-sensing, satellite-imagery
Landsat578
Very simple API to download Landsat [1-5, 7, 8] data from Google
Stars: ✭ 54 (-75.45%)
Mutual labels:  remote-sensing, satellite-imagery
Stanet
official implementation of the spatial-temporal attention neural network (STANet) for remote sensing image change detection
Stars: ✭ 109 (-50.45%)
Mutual labels:  remote-sensing, attention-mechanism
Label Maker
Data Preparation for Satellite Machine Learning
Stars: ✭ 377 (+71.36%)
Mutual labels:  remote-sensing, satellite-imagery
Modistsp
An "R" package for automatic download and preprocessing of MODIS Land Products Time Series
Stars: ✭ 118 (-46.36%)
Mutual labels:  remote-sensing, satellite-imagery
Awesome Satellite Imagery Datasets
🛰️ List of satellite image training datasets with annotations for computer vision and deep learning
Stars: ✭ 2,447 (+1012.27%)
Mutual labels:  remote-sensing, satellite-imagery
geoblaze
Blazing Fast JavaScript Raster Processing Engine
Stars: ✭ 80 (-63.64%)
Mutual labels:  remote-sensing, satellite-imagery
open-impact
To help quickstart impact work with Satellogic [hyperspectral] data
Stars: ✭ 21 (-90.45%)
Mutual labels:  remote-sensing, satellite-imagery
Geospatial Machine Learning
A curated list of resources focused on Machine Learning in Geospatial Data Science.
Stars: ✭ 289 (+31.36%)
Mutual labels:  remote-sensing, satellite-imagery
Geetools Code Editor
A set of tools to use in Google Earth Engine Code Editor (JavaScript)
Stars: ✭ 157 (-28.64%)
Mutual labels:  remote-sensing, satellite-imagery
Instancesegmentation sentinel2
🌱 Deep Learning for Instance Segmentation of Agricultural Fields - Master thesis
Stars: ✭ 206 (-6.36%)
Mutual labels:  remote-sensing, satellite-imagery
Sentinelsat
Search and download Copernicus Sentinel satellite images
Stars: ✭ 576 (+161.82%)
Mutual labels:  remote-sensing, satellite-imagery
sits
Satellite image time series in R
Stars: ✭ 342 (+55.45%)
Mutual labels:  remote-sensing, satellite-imagery
land-cover-to-land-use-classification
Satellite image processing pipeline to classify land-cover and land-use
Stars: ✭ 64 (-70.91%)
Mutual labels:  remote-sensing, satellite-imagery
massive-change-detection
QGIS 2 plugin for applying change detection algorithms on high resolution satellite imagery
Stars: ✭ 18 (-91.82%)
Mutual labels:  remote-sensing, change-detection

PWC PWC

ChangeFormer: A Transformer-Based Siamese Network for Change Detection

Wele Gedara Chaminda Bandara, and Vishal M. Patel

📔 Accepted for publication at IGARSS-22, Kuala Lumpur, Malaysia.

Here, we provide the pytorch implementation of the paper: A Transformer-Based Siamese Network for Change Detection.

📔 For more information, please see our paper at arxiv and Video on YouTube.

Updates

Our new Semi-supervised Change Detection paper is now online: SemiCD
ChangeFormer has been accepted for publication at IGARSS-22, Kuala Lumpur, Malaysia.

💬 Network Architecture

image-20210228153142126

💬 Quantitative & Qualitative Results on LEVIR-CD and DSIFN-CD

image-20210228153142126

💬 Requirements

Python 3.8.0
pytorch 1.10.1
torchvision 0.11.2
einops  0.3.2

Please see requirements.txt for all the other requirements. You can create a virtual conda environment named ChangeFormer with the following cmd:

conda create --name ChangeFormer --file requirements.txt
conda activate ChangeFormer

💬 Installation

Clone this repo:

git clone https://github.com/wgcban/ChangeFormer.git
cd ChangeFormer

💬 Quick Start on LEVIR dataset

We have some samples from the LEVIR-CD dataset in the folder samples_LEVIR for a quick start.

Firstly, you can download our ChangeFormerV6 pretrained model——by DropBox or Github. After downloaded the pretrained model, you can put it in checkpoints/ChangeFormer_LEVIR/.

Then, run a demo to get started as follows:

python demo_LEVIR.py

After that, you can find the prediction results in samples/predict_LEVIR.

💬 Quick Start on DSIFN dataset

We have some samples from the DSIFN-CD dataset in the folder samples_DSIFN for a quick start.

Firstly, you can download our ChangeFormerV6 pretrained model——by DropBox or Github. After downloaded the pretrained model, you can put it in checkpoints/ChangeFormer_DSIFN/.

Then, run a demo to get started as follows:

python demo_DSIFN.py

After that, you can find the prediction results in samples/predict_DSIFN.

💬 Train on LEVIR-CD

When we initialy train our ChangeFormer, we initialized some parameters of the network with a model pre-trained on the RGB segmentation (ADE 160k dataset) to get faster convergence.

You can download the pre-trained model here.

wget https://www.dropbox.com/s/undtrlxiz7bkag5/pretrained_changeformer.pt

Then, update the path to the pre-trained model by updating the path argument in the run_ChangeFormer_LEVIR.sh. Here:

pretrain=pretrained_changeformer/pretrained_changeformer.pt

You can find the training script run_ChangeFormer_LEVIR.sh in the folder scripts. You can run the script file by sh scripts/run_ChangeFormer_LEVIR.sh in the command environment.

The detailed script file run_ChangeFormer_LEVIR.sh is as follows:

#!/usr/bin/env bash

#GPUs
gpus=0

#Set paths
checkpoint_root=/media/lidan/ssd2/ChangeFormer/checkpoints
vis_root=/media/lidan/ssd2/ChangeFormer/vis
data_name=LEVIR


img_size=256    
batch_size=16   
lr=0.0001         
max_epochs=200
embed_dim=256

net_G=ChangeFormerV6        #ChangeFormerV6 is the finalized verion

lr_policy=linear
optimizer=adamw                 #Choices: sgd (set lr to 0.01), adam, adamw
loss=ce                         #Choices: ce, fl (Focal Loss), miou
multi_scale_train=True
multi_scale_infer=False
shuffle_AB=False

#Initializing from pretrained weights
pretrain=/media/lidan/ssd2/ChangeFormer/pretrained_segformer/segformer.b2.512x512.ade.160k.pth

#Train and Validation splits
split=train         #train
split_val=test      #test, val
project_name=CD_${net_G}_${data_name}_b${batch_size}_lr${lr}_${optimizer}_${split}_${split_val}_${max_epochs}_${lr_policy}_${loss}_multi_train_${multi_scale_train}_multi_infer_${multi_scale_infer}_shuffle_AB_${shuffle_AB}_embed_dim_${embed_dim}

CUDA_VISIBLE_DEVICES=1 python main_cd.py --img_size ${img_size} --loss ${loss} --checkpoint_root ${checkpoint_root} --vis_root ${vis_root} --lr_policy ${lr_policy} --optimizer ${optimizer} --pretrain ${pretrain} --split ${split} --split_val ${split_val} --net_G ${net_G} --multi_scale_train ${multi_scale_train} --multi_scale_infer ${multi_scale_infer} --gpu_ids ${gpus} --max_epochs ${max_epochs} --project_name ${project_name} --batch_size ${batch_size} --shuffle_AB ${shuffle_AB} --data_name ${data_name}  --lr ${lr} --embed_dim ${embed_dim}

💬 Train on DSIFN-CD

Follow the similar procedure mentioned for LEVIR-CD. Use run_ChangeFormer_DSIFN.sh in scripts folder to train on DSIFN-CD.

💬 Evaluate on LEVIR

You can find the evaluation script eval_ChangeFormer_LEVIR.sh in the folder scripts. You can run the script file by sh scripts/eval_ChangeFormer_LEVIR.sh in the command environment.

The detailed script file eval_ChangeFormer_LEVIR.sh is as follows:

#!/usr/bin/env bash

gpus=0

data_name=LEVIR
net_G=ChangeFormerV6 #This is the best version
split=test
vis_root=/media/lidan/ssd2/ChangeFormer/vis
project_name=CD_ChangeFormerV6_LEVIR_b16_lr0.0001_adamw_train_test_200_linear_ce_multi_train_True_multi_infer_False_shuffle_AB_False_embed_dim_256
checkpoints_root=/media/lidan/ssd2/ChangeFormer/checkpoints
checkpoint_name=best_ckpt.pt
img_size=256
embed_dim=256 #Make sure to change the embedding dim (best and default = 256)

CUDA_VISIBLE_DEVICES=0 python eval_cd.py --split ${split} --net_G ${net_G} --embed_dim ${embed_dim} --img_size ${img_size} --vis_root ${vis_root} --checkpoints_root ${checkpoints_root} --checkpoint_name ${checkpoint_name} --gpu_ids ${gpus} --project_name ${project_name} --data_name ${data_name}

💬 Evaluate on DSIFN

Follow the same evaluation procedure mentioned for LEVIR-CD. You can find the evaluation script eval_ChangeFormer_DSFIN.sh in the folder scripts. You can run the script file by sh scripts/eval_ChangeFormer_DSIFN.sh in the command environment.

💬 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.

👉 Links to download processed datsets used for train/val/test

You can download the processed LEVIR-CD and DSIFN-CD datasets by the DropBox through the following here:

Since the file sizes are large, I recommed to use command line and cosider downloading the zip file as follows (in linux):

To download LEVIR-CD dataset run following command in linux-terminal:

wget https://www.dropbox.com/s/h9jl2ygznsaeg5d/LEVIR-CD-256.zip

To download DSIFN-CD dataset run following command in linux-terminal:

wget https://www.dropbox.com/sh/i54h8kkpgar1s07/AAA0rBAFl9UZ3U3Z1_o46UT0a/DSIFN-CD-256.zip

For your reference, I have also attached the inks to original LEVIR-CD and DSIFN-CD here: LEVIR-CD and DSIFN-CD.

💬 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:

@misc{bandara2022transformerbased,
      title={A Transformer-Based Siamese Network for Change Detection}, 
      author={Wele Gedara Chaminda Bandara and Vishal M. Patel},
      year={2022},
      eprint={2201.01293},
      archivePrefix={arXiv},
      primaryClass={cs.CV}
}

💬 References

Appreciate the work from the following repositories:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].