BGMix in PyTorch
March 4, 2023 · View on GitHub
Implementation of "Background-Mixed Augmentation for Weakly Supervised Change Detection" in PyTorch.
📖Pipeline of the BGMix
📖Requirements
- python 3.9
- pytorch 1.9.1
- opencv-python 4.5.5.64
- torchvision 0.10.1
- pillow 9.1.1
📖Train
You can use the following commands to train and test:
python train.py
python test.py
train.py: the entry point for training.models/CG.py: defines the architecture of the Generator model and Discriminator models.options.py: creates option lists using theargparsepackage.datasets.py: process the dataset before passing it to the network.models/vgg16.py: defines the Classifier.models/models.py: defines the model.optimizer.py: defines the optimization.loss.py: defines the loss functions.
📔Pretrained Classifier
Because of the perceptual similarity loss, you need to train a Classifier to extract the semantic features.
python train_Classifier.py
📖Dataset Preparation
📔Data structure
train_data: The data for training.AICD: Aerial image change detection dataset.C: Change images.UC: Background images.
BCD: Building change detection dataset.C: Change images.UC: Background images.
test_data: The data for testing.AICD: Aerial image change detection.C: Change images.
BCD: Building change detection dataset.C: Change images.
📔Data Download
You can download the AICD dataset from The Aerial Imagery Change Detection (AICD) dataset
You can download the BCD dataset from the WHU Building change detection Dataset
Both cropped datasets can be downloaded here. Please cite their papers.
📖Visualization results
📔Examples of augmented image pairs
- AICD
- BCD
📔Examples of CD results
- AICD
- BCD
:speech_balloon: Bibtex
If you find this repo useful for your research, please cite our paper:
@article{huang2023bgmix,
title={Background-Mixed Augmentation for Weakly Supervised Change Detection},
author={Huang, Rui and Wang, Ruofei and Guo, Qing and Wei, Jieda and Zhang, Yuxiang and Fan, Wei and Liu, Yang},
journal={AAAI},
year={2023}
}