{"id":27086980,"url":"https://github.com/icon-lab/selfrdb","last_synced_at":"2025-07-24T18:17:37.201Z","repository":{"id":245506230,"uuid":"800851655","full_name":"icon-lab/SelfRDB","owner":"icon-lab","description":"Official PyTorch implementation of SelfRDB, a diffusion bridge model for multi-modal medical image synthesis","archived":false,"fork":false,"pushed_at":"2025-02-25T17:39:37.000Z","size":464,"stargazers_count":53,"open_issues_count":2,"forks_count":1,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-06-10T11:11:30.704Z","etag":null,"topics":["deep-learning","diffusion-bridge","diffusion-models","image-synthesis","image-to-image-translation","medical-imaging","neural-networks","python","pytorch","schrodinger-bridge"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-15T05:55:49.000Z","updated_at":"2025-06-08T14:27:24.000Z","dependencies_parsed_at":"2024-06-27T08:42:05.094Z","dependency_job_id":"92aae5b9-734a-45c5-8bdc-f6d62da199f9","html_url":"https://github.com/icon-lab/SelfRDB","commit_stats":null,"previous_names":["icon-lab/selfrdb"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/icon-lab/SelfRDB","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icon-lab%2FSelfRDB","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icon-lab%2FSelfRDB/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icon-lab%2FSelfRDB/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icon-lab%2FSelfRDB/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/icon-lab","download_url":"https://codeload.github.com/icon-lab/SelfRDB/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icon-lab%2FSelfRDB/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266886031,"owners_count":24001046,"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","status":"online","status_checked_at":"2025-07-24T02:00:09.469Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","diffusion-bridge","diffusion-models","image-synthesis","image-to-image-translation","medical-imaging","neural-networks","python","pytorch","schrodinger-bridge"],"created_at":"2025-04-06T05:49:05.533Z","updated_at":"2025-07-24T18:17:37.144Z","avatar_url":"https://github.com/icon-lab.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003chr\u003e\n\u003ch1 align=\"center\"\u003e\n  SelfRDB \u003cbr\u003e\n  \u003csub\u003eSelf-Consistent Recursive Diffusion Bridge for Medical Image Translation\u003c/sub\u003e\n\u003c/h1\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://github.com/fuat-arslan\" target=\"_blank\"\u003eFuat\u0026nbsp;Arslan\u003c/a\u003e\u003csup\u003e1,2\u003c/sup\u003e \u0026ensp; \u003cb\u003e\u0026middot;\u003c/b\u003e \u0026ensp;\n  \u003ca href=\"https://bilalkabas.github.io/\" target=\"_blank\"\u003eBilal\u0026nbsp;Kabas\u003c/a\u003e\u003csup\u003e1,2\u003c/sup\u003e \u0026ensp; \u003cb\u003e\u0026middot;\u003c/b\u003e \u0026ensp;\n  \u003ca href=\"https://onatdalmaz.com/\" target=\"_blank\"\u003eOnat\u0026nbsp;Dalmaz\u003c/a\u003e\u003csup\u003e3\u003c/sup\u003e \u0026ensp; \u003cb\u003e\u0026middot;\u003c/b\u003e \u0026ensp;\n  \u003ca href=\"https://scholar.google.com/citations?user=VaoGQnMAAAAJ\u0026hl=en\" target=\"_blank\"\u003eMuzaffer\u0026nbsp;Ozbey\u003c/a\u003e\u003csup\u003e4\u003c/sup\u003e \u0026ensp; \u003cb\u003e\u0026middot;\u003c/b\u003e \u0026ensp;\n  \u003ca href=\"https://kilyos.ee.bilkent.edu.tr/~cukur/\" target=\"_blank\"\u003eTolga\u0026nbsp;Çukur\u003c/a\u003e\u003csup\u003e1,2\u003c/sup\u003e \u0026ensp;\n  \n  \u003cspan\u003e\u003c/span\u003e\n  \n  \u003csup\u003e1\u003c/sup\u003eBilkent University \u0026emsp; \u003csup\u003e2\u003c/sup\u003eUMRAM \u0026emsp; \u003csup\u003e3\u003c/sup\u003eStanford University \u0026emsp; \u003csup\u003e4\u003c/sup\u003eUniversity of Illinois Urbana-Champaign \u003cbr\u003e\n\u003c/div\u003e\n\u003chr\u003e\n\n\u003ch3 align=\"center\"\u003e[\u003ca href=\"https://arxiv.org/abs/2405.06789\"\u003earXiv\u003c/a\u003e]\u003c/h3\u003e\n\nOfficial PyTorch implementation of **SelfRDB**, a novel diffusion bridge model for multi-modal medical image synthesis that employs a novel forward process with soft-prior, and self-consistent recursion in reverse process. Our novel noise scheduling with monotonically increasing variance towards the end-point, i.e. soft-prior, boosts generalization performance and facilitates information transfer between the two modalities. To further enhance sampling accuracy in each reverse step, SelfRDB utilizes a novel sampling procedure where the network recursively generates a transient-estimate of the target image until convergence onto a self-consistent solution.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"figures/architecture.png\" alt=\"architecture\" style=\"width: 650px; height: auto;\"\u003e\n\u003c/p\u003e\n\n\n## ⚙️ Installation\n\nThis repository has been developed and tested with `CUDA 11.7` and `Python 3.8`. Below commands create a conda environment with required packages. Make sure conda is installed.\n\n```\nconda env create --file requirements.yaml\nconda activate selfrdb\n```\n\n## 🗂️ Prepare dataset\n\nThe default data set class `NumpyDataset` requires the following folder structure to organize the data set. Modalities (T1, T2, etc.) are separated by folders, splits (train, val, test) are organized as subfolders which include 2D images: `slice_0.npy`, `slice_1.npy`, ... To use your custom data set class, set `dataset_class` to your own implementation in `dataset.py` by inheriting from the `BaseDataset` class.\n\n\u003e Images should be scaled to have pixel values in the range [0,1].\n\n```\n\u003cdataset\u003e/\n├── \u003cmodality_a\u003e/\n│   ├── train/\n│   │   ├── slice_0.npy\n│   │   ├── slice_1.npy\n│   │   └── ...\n│   ├── test/\n│   │   ├── slice_0.npy\n│   │   └── ...\n│   └── val/\n│       ├── slice_0.npy\n│       └── ...\n├── \u003cmodality_b\u003e/\n│   ├── train/\n│   ├── test/\n│   └── val/\n├── ...\n  \n```\n\n## 🏃 Training\n\nRun the following command to start/resume training. Model checkpoints are saved under `logs/$EXP_NAME/version_x/checkpoints` directory, and sample validation images are saved under `logs/$EXP_NAME/version_x/val_samples`. The script supports both single and multi-GPU training. By default, it runs on a single GPU. To enable multi-GPU training, set `--trainer.devices` argument to the list of devices, e.g. `0,1,2,3`.\n\n```\npython main.py fit \\\n    --config config.yaml \\\n    --trainer.logger.name $EXP_NAME \\\n    --data.dataset_dir $DATA_DIR \\\n    --data.source_modality $SOURCE \\\n    --data.target_modality $TARGET \\\n    --data.train_batch_size $BS_TRAIN \\\n    --data.val_batch_size $BS_VAL \\\n    [--trainer.max_epoch $N_EPOCHS] \\\n    [--ckpt_path $CKPT_PATH] \\\n    [--trainer.devices $DEVICES]\n\n```\n\n### Argument descriptions\n\n| Argument                    | Description                                                                                                                    |\n|-----------------------------|--------------------------------------------------------------------------------------------------------------------------------|\n| `--config`                  | Config file path.                                                                                                              |\n| `--trainer.logger.name`     | Experiment name.                                                                                                               |\n| `--data.dataset_dir`        | Data set directory.                                                                                                            |\n| `--data.source_modality`    | Source modality, e.g. 'T1', 'T2', 'PD'. Should match the folder name for that modality.                                        |\n| `--data.train_batch_size`   | Train set batch size.                                                                                                          |\n| `--data.val_batch_size`     | Validation set batch size.                                                                                                     |\n| `--trainer.max_epoch`       | [Optional] Number of training epochs (default: 50).                                                                            |\n| `--ckpt_path`               | [Optional] Model checkpoint path to resume training.                                                                           |\n| `--trainer.devices`         | [Optional] Device or list of devices. For multi-GPU set to the list of device ids, e.g `0,1,2,3` (default: `[0]`).             |\n\n\n## 🧪 Testing\n\nRun the following command to start testing. The predicted images are saved under `logs/$EXP_NAME/version_x/test_samples` directory. By default, the script runs on a single GPU. To enable multi-GPU testing, set `--trainer.devices` argument to the list of devices, e.g. `0,1,2,3`.\n\n```\npython main.py test \\\n    --config config.yaml \\\n    --data.dataset_dir $DATA_DIR \\\n    --data.source_modality $SOURCE \\\n    --data.target_modality $TARGET \\\n    --data.test_batch_size $BS_TEST \\\n    --ckpt_path $CKPT_PATH\n```\n\n### Argument descriptions\n\nSome arguments are common to both training and testing and are not listed here. For details on those arguments, please refer to the training section.\n\n| Argument                    | Description                                |\n|-----------------------------|--------------------------------------------|\n| `--data.test_batch_size`    | Test set batch size.                       |\n| `--ckpt_path`               | Model checkpoint path.                     |\n\n## 🦁 Model Zoo\nRefer to the testing section above to perform inference with the checkpoints. PSNR (dB) and SSIM (%) are listed as mean ± std across the test set.\n\n| Dataset   | Task      | PSNR               | SSIM                | Checkpoint                                                                                              |\n|-----------|-----------|--------------------|---------------------|---------------------------------------------------------------------------------------------------------|\n| IXI       | T2→T1     | 31.63 ± 1.53       | 95.64 ± 1.12        | [Link](https://github.com/icon-lab/SelfRDB/releases/download/v1.0.0/ixi_t2_t1.ckpt)                   |\n| IXI       | T1→T2     | 31.28 ± 1.56       | 95.03 ± 1.27        | [Link](https://github.com/icon-lab/SelfRDB/releases/download/v1.0.0/ixi_t1_t2.ckpt)                   |\n| IXI       | PD→T1     | 31.23 ± 1.22       | 95.64 ± 0.99        | [Link](https://github.com/icon-lab/SelfRDB/releases/download/v1.0.0/ixi_pd_t1.ckpt)                   |\n| IXI       | T1→PD     | 32.17 ± 1.57       | 95.15 ± 0.99        | [Link](https://github.com/icon-lab/SelfRDB/releases/download/v1.0.0/ixi_t1_pd.ckpt)                   |\n| BRATS     | T2→T1     | 28.85 ± 1.48       | 93.70 ± 1.87        | [Link](https://github.com/icon-lab/SelfRDB/releases/download/v1.0.0/brats_t2_t1.ckpt)                 |\n| BRATS     | T1→T2     | 27.58 ± 1.88       | 92.99 ± 2.44        | [Link](https://github.com/icon-lab/SelfRDB/releases/download/v1.0.0/brats_t1_t2.ckpt)                 |\n| BRATS     | FLAIR→T2  | 26.85 ± 1.75       | 91.66 ± 2.72        | [Link](https://github.com/icon-lab/SelfRDB/releases/download/v1.0.0/brats_flair_t2.ckpt)              |\n| BRATS     | T2→FLAIR  | 27.98 ± 1.80       | 90.01 ± 2.70        | [Link](https://github.com/icon-lab/SelfRDB/releases/download/v1.0.0/brats_t2_flair.ckpt)              |\n| CT        | T2→CT     | 29.18 ± 2.18       | 93.28 ± 1.99        | [Link](https://github.com/icon-lab/SelfRDB/releases/download/v1.0.0/ct_t2_ct.ckpt)                    |\n| CT        | T1→CT     | 27.55 ± 3.32       | 92.29 ± 6.32        | [Link](https://github.com/icon-lab/SelfRDB/releases/download/v1.0.0/ct_t1_ct.ckpt)                    |\n\n## ✒️ Citation\nYou are encouraged to modify/distribute this code. However, please acknowledge this code and cite the paper appropriately.\n```\n@article{arslan2024selfconsistent,\n  title={Self-Consistent Recursive Diffusion Bridge for Medical Image Translation}, \n  author={Fuat Arslan and Bilal Kabas and Onat Dalmaz and Muzaffer Ozbey and Tolga Çukur},\n  year={2024},\n  journal={arXiv:2405.06789}\n}\n```\n\n\n\u003chr\u003e\n\nCopyright © 2024, ICON Lab.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficon-lab%2Fselfrdb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ficon-lab%2Fselfrdb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficon-lab%2Fselfrdb/lists"}