8000 GitHub - yb23/HySCDG
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

yb23/HySCDG

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The Change You Want To Detect: Semantic Change Detection In Earth Observation With Hybrid Data Generation [CVPR 2025]

Paper PDF arXiv Project Page

Univ Gustave Eiffel, ENSG, IGN, LASTIG

Yanis Benidir, Nicolas Gonthier, Clément Mallet

If you ❤️ or simply use this project, don't forget to give the repository a ⭐, it means a lot to us !

@inproceedings{benidir2025cywd,
  title={The Change You Want To Detect: Semantic Change Detection In Earth Observation With Hybrid Data Generation},
  author={Benidir, Yanis and Gonthier, Nicolas and Mallet, Clément},
  booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year={2025}
}

Overview

This repository is the official implementation to run the experiment of "The Change You Want to Detect" paper. It can be used to run the transfert learning experiments and evaluation on 5 different change detection dataset but also to generate new pair of images with change

Quick Start

First, clone this repository to your local machine, and install the dependencies (torch, torchvision, numpy, Pillow, and huggingface_hub).

git clone git@github.com:yb23/HySCDG.git
cd HySCDG
pip install -r requirements.txt

Transfer Learning Experiments

The following commands can fine-tune the pretrained change detection model for different transfer learning settings.

Sequential mode: Pretraining + Fine-tuning

python train.py --sequential --batch=8 -mc --classes=20 --in_channels=3 --logdir=/my-folder/logs/ -p="MyWandbProject" --log_images_every=1 --model="unet" --pretrain_name="fsc" --pretrain_path=datasets/fsc-180k/ --fsc_versions 11 12 --mix_fsc_versions --epochs=10 --target_name="hiucd" --target_path=datasets/hiucd_mini_512/ --epochs_finetune=50 --new_n_classes=10

Sequential mode: Only Fine-tuning

python train.py --sequential --no_pretrain --batch=8 -mc --classes=20 --in_channels=3 --logdir=/my-folder/logs/ -p="MyWandbProject" --log_images_every=1 --model="unet" --pretrain_name="fsc" --pretrain_path=datasets/fsc-180k/ --fsc_versions 11 12 --mix_fsc_versions --epochs=0 --target_name="hiucd" --target_path=datasets/hiucd_mini_512/ --epochs_finetune=50 --new_n_classes=10 --run_id="WANDB_ID_OF_PRETRAINING_RUN"

Mixed mode: Pretraining x Fine-tuning

python train.py --mixed --mix_ratio=0.5 --batch=8 -mc --classes=10 --in_channels=3 --logdir=/my-folder/logs/ -p="MyWandbProject" --log_images_every=1 --model="unet" --pretrain_name="fsc" --pretrain_path=datasets/fsc-180k/ --fsc_versions 11 12 --mix_fsc_versions --epochs=10 --target_name="hiucd" --target_path=datasets/hiucd_mini_512/

Low Data Regime

python train.py --sequential --target_max_proportion=0.10 --batch=8 -mc --classes=20 --in_channels=3 --logdir=/my-folder/logs/ -p="MyWandbProject" --log_images_every=1 --model="unet" --pretrain_name="fsc" --pretrain_path=datasets/fsc-180k/ --fsc_versions 11 12 --mix_fsc_versions --epochs=10 --target_name="hiucd" --target_path=datasets/hiucd_mini_512/ --epochs_finetune=200 --new_n_classes=10

Evaluation (Inference) Only

python train.py --only_test --sequential --no_pretrain --batch=8 -mc --classes=20 --in_channels=3 --logdir=/my-folder/logs/ -p="MyWandbProject" --log_images_every=1 --model="unet" --pretrain_name="fsc" --pretrain_path=datasets/fsc-180k/ --fsc_versions 11 12 --mix_fsc_versions --epochs=0 --target_name="hiucd" --target_path=datasets/hiucd_mini_512/ --epochs_finetune=0 --new_n_classes=10 --run_id="WANDB_ID_OF_PRETRAINING_RUN"

Other tips

  • If you want to evaluate the model on a pretraining dataset, you should pass --target_name="". In this case, the target dataset will be the validation split of the pretraining dataset.

  • --resume and --run_id : If you want to continue an interrupted run, you have to provide the run_id of the run as well as the --resume argument (--run_id="WANDB_RUN_ID" --resume). If you just want to initialize the model weights from a specific checkpoint, you must only provide the --run_id. It can be either a WANDB_RUN_ID or directly a path to a .ckpt file.

Hybrid Semantic Change Dataset Generation

The following command can be used to generate new samples from the hybrid change detection dataset.

python generate.py --model_path="path_to_inpainting_pipeline/trained_pipeline" --controlnet_path="path_to_controlnet/trained_controlnet" --batch=1 --images_path="path_to_flair/flair_aerial_train" --save_dir="../data/CHG" --prompts_path="../data/FLAIR_Prompts.csv" --dfobjects_path="../data/instancesFootprints.pkl" --num_version=15

If you need to run the code on CPU, simply add the --cpu flag.

Our pretrained pipeline is available on HuggingFace : https://huggingface.co/Yanis236/HySCDG. It can be directly used to run the generation pipeline.

Needed data The provided code is adapted to FLAIR data.

If you want to use another dataset as a basis for generation, you will have to adapt the "FLAIR_Dataset" class to the structure of your data and use your own prompts. Don't hesitate to reach out to us if you need further information.

Useful links

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0