{"id":27086994,"url":"https://github.com/icon-lab/syndiff","last_synced_at":"2025-04-06T05:49:07.600Z","repository":{"id":118019038,"uuid":"525327651","full_name":"icon-lab/SynDiff","owner":"icon-lab","description":"Official PyTorch implementation of SynDiff described in the paper (https://arxiv.org/abs/2207.08208).","archived":false,"fork":false,"pushed_at":"2023-11-27T04:00:54.000Z","size":10242,"stargazers_count":134,"open_issues_count":5,"forks_count":23,"subscribers_count":4,"default_branch":"main","last_synced_at":"2023-11-27T05:22:14.845Z","etag":null,"topics":["deep-learning","denoising-diffusion-models","diffusion-model","diffusion-models","image-synthesis","image-to-image-translation","medical-image-synthesis","medical-imaging","unsupervised"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/icon-lab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2022-08-16T10:15:54.000Z","updated_at":"2023-11-27T05:22:21.011Z","dependencies_parsed_at":"2023-11-27T05:22:20.478Z","dependency_job_id":"244784ae-3adc-454c-a36d-e758ebe57809","html_url":"https://github.com/icon-lab/SynDiff","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icon-lab%2FSynDiff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icon-lab%2FSynDiff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icon-lab%2FSynDiff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icon-lab%2FSynDiff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/icon-lab","download_url":"https://codeload.github.com/icon-lab/SynDiff/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247441007,"owners_count":20939236,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deep-learning","denoising-diffusion-models","diffusion-model","diffusion-models","image-synthesis","image-to-image-translation","medical-image-synthesis","medical-imaging","unsupervised"],"created_at":"2025-04-06T05:49:07.091Z","updated_at":"2025-04-06T05:49:07.588Z","avatar_url":"https://github.com/icon-lab.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SynDiff\n\nOfficial PyTorch implementation of SynDiff described in the [paper](https://arxiv.org/abs/2207.08208).\n\nMuzaffer Ö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\", arXiv 2022.\n\n\u003cimg src=\"./figures/adv_diff.png\" width=\"600px\"\u003e\n\n\u003cimg src=\"./figures/syndiff.png\" width=\"600px\"\u003e\n\n## Dependencies\n\n```\npython\u003e=3.6.9\ntorch\u003e=1.7.1\ntorchvision\u003e=0.8.2\ncuda=\u003e11.2\nninja\npython3.x-dev (apt install, x should match your python3 version, ex: 3.8)\n```\n\n## Installation\n- Clone this repo:\n```bash\ngit clone https://github.com/icon-lab/SynDiff\ncd SynDiff\n```\n\n## Dataset\nYou should structure your aligned dataset in the following way:\n\n\n\n```\ninput_path/\n  ├── data_train_contrast1.mat\n  ├── data_train_contrast2.mat\n  ├── data_val_contrast1.mat\n  ├── data_val_contrast2.mat\n  ├── data_test_contrast1.mat\n  ├── data_test_contrast2.mat\n```\n\nwhere .mat files has shape of (#images, width, height) and image values are between 0 and 1.0. \n### Sample Data\nSample toy data can also found under 'SynDiff_sample_data' folder of the repository. \n\n\n\n## Train\n\n\u003cbr /\u003e\n\n```\npython3 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\n```\n\n\u003cbr /\u003e\n\n## Pretrained Models\nWe have released pretrained diffusive generators for [T1-\u003ePD and PD-\u003eT1](https://drive.google.com/file/d/1Hfvnz29NaTFqPMX6RGaEv4Qnt8HeoxZz/view?usp=sharing) tasks in IXI and [T1-\u003eT2 and T2-\u003eT1](https://drive.google.com/file/d/1zGzZPVY-Xp2Flc7GicOD7s4taxcjwCsn/view?usp=sharing) tasks in BRATS datasets. You can save these weights in relevant checkpoints folder and perform inference.\n\n## Test\n\n\u003cbr /\u003e\n\n```\npython 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\n```\n\n\u003cbr /\u003e\n\u003cbr /\u003e\n\n\n# Citation\nPreliminary versions of SynDiff are presented in [NeurIPS Medical Imaging Meets](https://www.cse.cuhk.edu.hk/~qdou/public/medneurips2022/105.pdf) and IEEE ISBI 2023.\nYou are encouraged to modify/distribute this code. However, please acknowledge this code and cite the paper appropriately.\n```\n@misc{özbey2023unsupervised,\n      title={Unsupervised Medical Image Translation with Adversarial Diffusion Models}, \n      author={Muzaffer Özbey and Onat Dalmaz and Salman UH Dar and Hasan A Bedel and Şaban Özturk and Alper Güngör and Tolga Çukur},\n      year={2023},\n      eprint={2207.08208},\n      archivePrefix={arXiv},\n      primaryClass={eess.IV}\n}\n\n```\nFor any questions, comments and contributions, please contact Muzaffer Özbey (muzafferozbey94[at]gmail.com ) \u003cbr /\u003e\n\n(c) ICON Lab 2022\n\n\u003cbr /\u003e\n\n# Acknowledgements\n\nThis code uses libraries from, [pGAN](https://github.com/icon-lab/pGAN-cGAN), [StyleGAN-2](https://github.com/NVlabs/stylegan2), and [DD-GAN](https://github.com/NVlabs/denoising-diffusion-gan) repositories.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficon-lab%2Fsyndiff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ficon-lab%2Fsyndiff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficon-lab%2Fsyndiff/lists"}