← Open Source
wgcban

ChangeFormer

[IGARSS'22]: A Transformer-Based Siamese Network for Change Detection.

Model DevelopmentArchitecturePython
Open on GitHub
Momentum
+0stars in 24 hours0.0%
627
Stars
86
Forks
+1
This week
1
Contributors
Created 2021-12-02 · Updated 2026-10-12 · #15860 today
Top developers

wgcban/ChangeFormer is ranked 15,860 with 627 stars.

Same-category comparison

wgcban/ChangeFormer is ranked 15,860 among these 8 peers; akanimax/BMSG-GAN is ranked 15,856.

Same-category comparison
NameRankMetrics
OndrejTexler/Few-Shot-Patch-Based-Training15,853
Language:
C++
Stars:
627
Forks:
108
Description:
The official implementation of our SIGGRAPH 2020 paper Interactive Video Stylization Using Few-Shot Patch-Based Training.
PaddlePaddle/Parakeet15,854
Language:
Python
Stars:
627
Forks:
83
Description:
PAddle PARAllel text-to-speech toolKIT (supporting Tacotron2, Transformer TTS, FastSpeech2/FastPitch, SpeedySpeech, WaveFlow and Parallel WaveGAN).
ZebangCheng/Emotion-LLaMA15,855
Language:
Python
Stars:
627
Forks:
77
Description:
Emotion-LLaMA: Multimodal Emotion Recognition and Reasoning with Instruction Tuning.
akanimax/BMSG-GAN15,856
Language:
Python
Stars:
627
Forks:
103
Description:
[MSG-GAN] Any body can GAN. Highly stable and robust architecture. Requires little to no hyperparameter tuning. Pytorch Implementation.
alasdairforsythe/tokenmonster15,868
Language:
Go
Stars:
626
Forks:
23
Description:
Ungreedy subword tokenizer and vocabulary trainer for Python, Go, C++ & Javascript.
buriburisuri/ByteNet15,869
Language:
Python
Stars:
626
Forks:
93
Description:
A tensorflow implementation of French-to-English machine translation using DeepMind's ByteNet .
christiansafka/img2vec15,870
Language:
Python
Stars:
626
Forks:
98
Description:
:fire: Use pre-trained models in PyTorch to extract vector embeddings for any image.
danijar/dreamer15,871
Language:
Python
Stars:
626
Forks:
120
Description:
Dream to Control: Learning Behaviors by Latent Imagination.
Key parameters and specifications
Key parameters and specifications
ParameterValue
LanguagePython
CategoryModel Development
SubcategoryArchitecture
KeywordsComputer vision
Stars627
Forks86
Contributors1
Created date2021-12-02
Updated date2026-10-12
Stars in 1 day0
Stars in 7 days1
Rank15,860
Previous rank15,662
Rank change-198
7-day stars rank11,113
Previous 7-day stars rank11,180
7-day stars rank change67
Total stars rank16,219
Previous total stars rank16,196
Total stars rank change-23
CountryUSA
README summary

ChangeFormer: A Transformer-Based Siamese Network for Change Detection A Transformer-Based Siamese Network for Change Detection Wele Gedara Chaminda Bandara, and Vishal M. Patel Presented at IGARSS-22, Kuala Lumpur, Malaysia. Useful links: Paper (published): Paper (ArXiv): Presentation (in YouTube): My other Change Detection repos: Change Detection with Denoising Diffusion Probabilistic Models: DDPM-CD Semi-supervised Change Detection: SemiCD Unsupervised Change Detection: Metric-CD Network Architecture Quantitative & Qualitative Results on LEVIR-CD and DSIFN-CD Usage Requirements Please see

for all the other requirements. Setting up conda environment: Create a virtual conda environment named ChangeFormer with the following command: Installation Clone this repo: Quick Start on LEVIR dataset We have some samples from the LEVIR-CD dataset in the folder for a quick start. Run a demo to get started as follows: You can find the prediction results in . Quick Start on DSIFN dataset We have some samples from the dataset in the folder for a quick start. After

downloaded the pretrained model, you can put it in . Run the demo to get started as follows: You can find the prediction results in . Training 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 . Then, update the path to the pre-trained model by updating the path argument in the

run_ChangeFormer_LEVIR. Here: You can find the training script in the folder . You can run the script file by in the command environment. The detailed script file is as follows: Training on DSIFN-CD Follow the similar procedure mentioned for LEVIR-CD. Evaluate on LEVIR You can find the evaluation script in the folder . You can run the script file by in the command environment. The detailed script file is as follows: Evaluate on DSIFN Follow the same evaluation

procedure mentioned for LEVIR-CD. You can find the evaluation script in the folder . You can run the script file by in the command environment. Dataset Preparation Data structure : images of t1 phase; :images of t2 phase; : label maps; : contains , each file records the image names (XXX. Links to processed datsets used for train/val/test You can download the processed and datasets by the DropBox through the following here: LEVIR-CD-256: DSIFN-CD-256: 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: To download DSIFN-CD dataset run following command in linux-terminal: For your reference, I have also attached the inks to original LEVIR-CD and DSIFN-CD here: and . Other useful notes ChangeFormer for multi-class change detection If you wish to use ChangeFormer for multi-class change detection, you will

need to make a few modifications to the existing codebase, which is designed for binary change detection. There are many

Frequently asked questions

How many stars and forks are recorded?

wgcban/ChangeFormer has 627 stars and 86 forks.

What is the repository rank?

wgcban/ChangeFormer is ranked 15,860.

What language and category are recorded?

wgcban/ChangeFormer has 627 stars, uses Python and belongs to Model Development.

Which repository is closest in rank?

wgcban/ChangeFormer is compared with akanimax/BMSG-GAN, ranked 15,856 with 627 stars.

README

ChangeFormer: A Transformer-Based Siamese Network for Change Detection

A Transformer-Based Siamese Network for Change Detection

Wele Gedara Chaminda Bandara, and Vishal M. Patel

Presented at IGARSS-22, Kuala Lumpur, Malaysia.

Useful links:

My other Change Detection repos:

  • Change Detection with Denoising Diffusion Probabilistic Models: DDPM-CD
  • Semi-supervised Change Detection: SemiCD
  • Unsupervised Change Detection: Metric-CD

Network Architecture

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

Usage

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.

Setting up conda environment:

Create a virtual conda environment named ChangeFormer with the following command:

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 Github-LEVIR-Pretrained.

Place it in checkpoints/ChangeFormer_LEVIR/.

Run a demo to get started as follows:

python demo_LEVIR.py

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.

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

Run the demo to get started as follows:

python demo_DSIFN.py

You can find the prediction results in samples/predict_DSIFN.

Training 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 Github-LEVIR-Pretrained.

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: https://github.com/wgcban/ChangeFormer/blob/a3eca2b1ec5d0d2628ea2e0b6beae85630ba79d4/scripts/run_ChangeFormer_LEVIR.sh#L28

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}

Training 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 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/18fb5jo0npu5evm/LEVIR-CD256.zip

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

wget https://www.dropbox.com/s/18fb5jo0npu5evm/LEVIR-CD256.zip

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

Other useful notes

ChangeFormer for multi-class change detection

If you wish to use ChangeFormer for multi-class change detection, you will need to make a few modifications to the existing codebase, which is designed for binary change detection. There are many discussions in the issues section. The required modifications are (https://github.com/wgcban/ChangeFormer/issues/93#issuecomment-1918609871):

  1. run_ChangeFormer_cd.sh: n_class=8 and make it a hyperparameter to python main.py
  2. models/networks.py: net = ChangeFormerV6(embed_dim=args.embed_dim, output_nc=args.n_class)
  3. models/basic_model.py: Comment out: pred_vis = pred * 255, i.e., modifications to visualisation processing
  4. models/trainer.py: Modify: ConfuseMatrixMeter(n_class=self.n_class)

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:

@INPROCEEDINGS{9883686,
  author={Bandara, Wele Gedara Chaminda and Patel, Vishal M.},
  booktitle={IGARSS 2022 - 2022 IEEE International Geoscience and Remote Sensing Symposium}, 
  title={A Transformer-Based Siamese Network for Change Detection}, 
  year={2022},
  volume={},
  number={},
  pages={207-210},
  doi={10.1109/IGARSS46834.2022.9883686}}

Disclaimer

Appreciate the work from the following repositories:

Nearby in the ranking
Similar items