Code implementation of "Learning Efficient Unsupervised Satellite Image-based Building Damage Detection" from ICDM 2023.
This repository contains code for U-BDD++.
Our work uses the public xBD dataset from xView2 challenge. You can find the dataset from here (account required). Please download the "Challenge training set", "Challenge test set" and "Challenge holdout set" datasets and follow the instructions on the website to unpack the files.
After downloading the dataset, the file structure should be similar to:
[xBD root folder]
├── hold
│ ├── images
│ └── labels
├── test
│ ├── images
│ └── labels
└── train
├── images
└── labels
Firstly, the data needs to be preprocessed before training. Please run the following command to preprocess the data:
python datasets/preprocess-data.py --data_dir <path to xBD root folder>
This will create a new folder masks
under each dataset split folder, which contains the damage masks for each building.
To start, please clone this repository to your local machine and follow the instructions below.
This repository requires python>=3.9
, pytorch>=1.13
and torchvision>=0.14
. Older versions may work, but they are not tested.
pip install git+https://github.com/facebookresearch/segment-anything.git
pip install git+https://github.com/IDEA-Research/GroundingDINO.git
pip install -r requirements.txt
As per installation requirement from Grounding DINO, please make sure the environment variable CUDA_HOME
is set.
export CUDA_HOME=/path/to/cuda-xx.x
Additionally, DINO requires building the custom PyTorch ops:
cd models/dino/ops
python setup.py build install
You can download the pre-trained weights of U-BDD++ for evaluation.
[Coming Soon]
To evaluate U-BDD++ on xBD dataset, please run:
CUDA_VISIBLE_DEVICES=0 python predict.py --test-set-path "path/to/xbd/test" --dino-path "path/to/dino/weights" --dino-config "path/to/dino/config" --sam-path "path/to/sam/weights"
# for example
CUDA_VISIBLE_DEVICES=0 python predict-pretrain.py --test-set-path "/home/datasets/xbd/test" --dino-path "/home/outputs/dino/resnet/bld-det-pl-2023-06-22-19-53-11/checkpoint0011.pth" --dino-config "/home/U-BDD/models/dino/config/DINO_4scale_UBDD_resnet.py" --sam-path "/home/checkpoints/SAM/sam_vit_h_4b8939.pth"
This repository is released under the MIT license. Please see the LICENSE file for more information.
Part of this repository used the following repositories:
Related repositories:
Thanks to the authors for their great work!
If you find this repository useful in your research, please use the following BibTeX for citation:
@article{zhang2023ubdd,
title={Learning Efficient Unsupervised Satellite Image-based Building Damage Detection},
author={Zhang, Yiyun and Wang, Zijian and Luo, Yadan and Yu, Xin and Huang, Zi},
journal={},
year={2023}
}