Thanks to visit codestin.com
Credit goes to github.com

Skip to content

wang-soonandsoon/BDBM

 
 

Repository files navigation

Bidirectional Diffusion Bridge Models

This is the official implementation of Bidirectional Diffusion Bridge Models (SIGKDD 2025)

img

Requirements

cond env create -f environment.yml
conda activate BDBM

Data preparation

Paired translation task

For datasets that have paired image data, the path should be formatted as:

your_dataset_path/train/A  # training reference
your_dataset_path/train/B  # training ground truth
your_dataset_path/val/A  # validating reference
your_dataset_path/val/B  # validating ground truth
your_dataset_path/test/A  # testing reference
your_dataset_path/test/B  # testing ground truth

We provide split script to preprocess dataset downloaded from Pix2Pix repository, remember to specify the dataset path

python3 datasets/split_pix2pix_datasets.py

After that, the dataset configuration should be specified in config file as:

dataset_name: 'your_dataset_name'
dataset_type: 'custom_aligned'
dataset_config:
  dataset_path: 'your_dataset_path'

Train and Test

Specify your configuration file

Modify the configuration file based on our templates in configs/*.yaml If training on latent space, don't forget to specify your VQGAN checkpoint path and dataset path.

Specity your training and tesing shell

If you wish to train from the beginning

python3 main.py --config configs/Template_LBBDM_f4.yaml --train --sample_at_start --save_top --gpu_ids 0 

If you wish to continue training, specify the model checkpoint path and optimizer checkpoint path in the train part.

python3 main.py --config configs/Template_LBBDM_f4.yaml --train --sample_at_start --save_top --gpu_ids 0 
--resume_model path/to/model_ckpt --resume_optim path/to/optim_ckpt

If you wish to sample the whole test dataset to evaluate metrics

python3 main.py --config configs/Template_LBBDM_f4.yaml --sample_to_eval --gpu_ids 0 --resume_model path/to/model_ckpt

Note that optimizer checkpoint is not needed in test and specifying checkpoint path in commandline has higher priority than specifying in configuration file.

Acknowledgement

Our code is implemented based on Latent Diffusion Model, VQGAN, and Brownian Bridge Diffusion Models

Latent Diffusion Models
VQGAN
Brownian Bridge Diffusion Model

Citation

@article{kieu2025bidirectional,
  title={Bidirectional Diffusion Bridge Models},
  author={Kieu, Duc and Do, Kien and Nguyen, Toan and Nguyen, Dang and Nguyen, Thin},
  journal={arXiv preprint arXiv:2502.09655},
  year={2025}
}

About

Official implementation of Bidirectional Diffusion Bridge Models

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 99.9%
  • Shell 0.1%