Diffusion probabilistic models are generative AI models, capable of generating high fidelity images. By gradually adding noise to the input data (forward diffusion), and learning to generate the input
from noise (reverse diffusion), DPMs have achieved state of the art performance in image generation. We used a DPM to predict active MS lesions similar to subtracted pre-and post contrast T1 weighted
images (ground truth). We performed leave one out K-fold cross validation for training and validation of DPM. To measure the overlap between predicted and ground truth active lesions, we used Dice
Similarity (DS).

import yaml
import os
from tqdm import tqdm
with open("environment.yml") as file_handle:
environment_data = yaml.safe_load(file_handle)
for dependency in environment_data["dependencies"]:
if isinstance(dependency, dict):
for lib in tqdm(dependency['pip']):
os.system(f"pip install {lib}")
!pip install wandb
!pip install pytorch_fid
!pip install pydicom
python main.py --train --config ./configs/configfilename.yaml --result_path ./save/directory/ --gpu_ids 0
python main.py --config ./configs/configfilename.yaml --result_path ./save/directory/ --resume_model ./save/directory/BrownianBridge/checkpoint/checkpoint_name.pth --gpu_ids 0
python main.py --evaluate --maskpath path/to/annotations/ --config ./configs/configfilename.yaml --result_path ./save/directory/ --resume_model ./save/directory/BrownianBridge/checkpoint/checkpoint_name.pth --gpu_ids 0
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 used Diffusion Probabilistic Model proposed by Bo Li et al 2023, referenced below
@inproceedings{li2023bbdm,
title={BBDM: Image-to-image translation with Brownian bridge diffusion models},
author={Li, Bo and Xue, Kaitao and Liu, Bin and Lai, Yu-Kun},
booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
pages={1952--1961},
year={2023}
}