SynDiff
Official PyTorch implementation of SynDiff described in the paper (https://arxiv.org/abs/2207.08208).
Install / Use
/learn @icon-lab/SynDiffREADME
SynDiff
Official PyTorch implementation of SynDiff described in the paper.
Muzaffer Özbey*, Onat Dalmaz*, Salman UH Dar, Hasan A Bedel, Şaban Özturk, Alper Güngör, Tolga Çukur, "Unsupervised Medical Image Translation With Adversarial Diffusion Models," in IEEE Transactions on Medical Imaging, vol. 42, no. 12, pp. 3524-3539, Dec. 2023, doi: 10.1109/TMI.2023.3290149.
*: equal contribution
<img src="./figures/adv_diff.png" width="600px"> <img src="./figures/syndiff.png" width="600px">Dependencies
python>=3.6.9
torch>=1.7.1
torchvision>=0.8.2
cuda=>11.2
ninja
python3.x-dev (apt install, x should match your python3 version, ex: 3.8)
Installation
- Clone this repo:
git clone https://github.com/icon-lab/SynDiff
cd SynDiff
Dataset
You should structure your aligned dataset in the following way:
input_path/
├── data_train_contrast1.mat
├── data_train_contrast2.mat
├── data_val_contrast1.mat
├── data_val_contrast2.mat
├── data_test_contrast1.mat
├── data_test_contrast2.mat
where .mat files has shape of (#images, width, height) and image values are between 0 and 1.0.
Sample Data
Sample toy data can also found under 'SynDiff_sample_data' folder of the repository.
Train
<br />python3 train.py --image_size 256 --exp exp_syndiff --num_channels 2 --num_channels_dae 64 --ch_mult 1 1 2 2 4 4 --num_timesteps 4 --num_res_blocks 2 --batch_size 1 --contrast1 T1 --contrast2 T2 --num_epoch 500 --ngf 64 --embedding_type positional --use_ema --ema_decay 0.999 --r1_gamma 1. --z_emb_dim 256 --lr_d 1e-4 --lr_g 1.6e-4 --lazy_reg 10 --num_process_per_node 1 --save_content --local_rank 0 --input_path /input/path/for/data --output_path /output/for/results
<br />
Pretrained Models
We have released pretrained diffusive generators for T1->PD and PD->T1 tasks in IXI and T1->T2 and T2->T1 tasks in BRATS datasets. You can save these weights in relevant checkpoints folder and perform inference.
Test
<br />python test.py --image_size 256 --exp exp_syndiff --num_channels 2 --num_channels_dae 64 --ch_mult 1 1 2 2 4 4 --num_timesteps 4 --num_res_blocks 2 --batch_size 1 --embedding_type positional --z_emb_dim 256 --contrast1 T1 --contrast2 T2 --which_epoch 50 --gpu_chose 0 --input_path /input/path/for/data --output_path /output/for/results
<br />
<br />
Citation
Preliminary versions of SynDiff are presented in NeurIPS Medical Imaging Meets and IEEE ISBI 2023. You are encouraged to modify/distribute this code. However, please acknowledge this code and cite the paper appropriately.
@ARTICLE{ozbey_dalmaz_syndiff_2024,
author={Özbey, Muzaffer and Dalmaz, Onat and Dar, Salman U. H. and Bedel, Hasan A. and Özturk, Şaban and Güngör, Alper and Çukur, Tolga},
journal={IEEE Transactions on Medical Imaging},
title={Unsupervised Medical Image Translation With Adversarial Diffusion Models},
year={2023},
volume={42},
number={12},
pages={3524-3539},
keywords={Biological system modeling;Computational modeling;Training;Generative adversarial networks;Image synthesis;Task analysis;Generators;Medical image translation;synthesis;unsupervised;unpaired;adversarial;diffusion;generative},
doi={10.1109/TMI.2023.3290149}}
For any questions, comments and contributions, please contact Muzaffer Özbey (muzafferozbey94[at]gmail.com) or Onat Dalmaz (onat[at]stanford.edu) <br />
(c) ICON Lab 2023
<br />Acknowledgements
This code uses libraries from, pGAN, StyleGAN-2, and DD-GAN repositories.
Related Skills
YC-Killer
2.7kA library of enterprise-grade AI agents designed to democratize artificial intelligence and provide free, open-source alternatives to overvalued Y Combinator startups. If you are excited about democratizing AI access & AI agents, please star ⭐️ this repository and use the link in the readme to join our open source AI research team.
openclaw-plugin-loom
Loom Learning Graph Skill This skill guides agents on how to use the Loom plugin to build and expand a learning graph over time. Purpose - Help users navigate learning paths (e.g., Nix, German)
best-practices-researcher
The most comprehensive Claude Code skills registry | Web Search: https://skills-registry-web.vercel.app
research_rules
Research & Verification Rules Quote Verification Protocol Primary Task "Make sure that the quote is relevant to the chapter and so you we want to make sure that we want to have it identifie