Improve model card for Fast-DDPM with paper, code, and usage
Browse filesThis PR significantly improves the model card for Fast-DDPM.
It includes:
- A link to the paper: [Fast-DDPM: Fast Denoising Diffusion Probabilistic Models for Medical Image-to-Image Generation](https://huggingface.co/papers/2405.14802)
- A link to the official GitHub repository: https://github.com/mirthAI/Fast-DDPM
- The `pipeline_tag: image-to-image` for enhanced discoverability on the Hugging Face Hub (https://huggingface.co/models?pipeline_tag=image-to-image).
- The full abstract of the paper.
- An illustrative overview image.
- Detailed usage instructions for training and sampling from the GitHub repository.
- The appropriate BibTeX citation.
Please review and merge these additions to provide a more comprehensive and useful resource for the community.
@@ -1,3 +1,116 @@
|
|
1 |
-
---
|
2 |
-
license: mit
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: mit
|
3 |
+
pipeline_tag: image-to-image
|
4 |
+
---
|
5 |
+
|
6 |
+
# Fast-DDPM: Fast Denoising Diffusion Probabilistic Models for Medical Image-to-Image Generation
|
7 |
+
|
8 |
+
This repository contains the official PyTorch implementation of the paper [Fast-DDPM: Fast Denoising Diffusion Probabilistic Models for Medical Image-to-Image Generation](https://huggingface.co/papers/2405.14802).
|
9 |
+
|
10 |
+
For the full codebase and more details, please visit the official GitHub repository: [https://github.com/mirthAI/Fast-DDPM](https://github.com/mirthAI/Fast-DDPM)
|
11 |
+
|
12 |
+
## Abstract
|
13 |
+
Denoising diffusion probabilistic models (DDPMs) have achieved unprecedented success in computer vision. However, they remain underutilized in medical imaging, a field crucial for disease diagnosis and treatment planning. This is primarily due to the high computational cost associated with (1) the use of large number of time steps (e.g., 1,000) in diffusion processes and (2) the increased dimensionality of medical images, which are often 3D or 4D. Training a diffusion model on medical images typically takes days to weeks, while sampling each image volume takes minutes to hours. To address this challenge, we introduce Fast-DDPM, a simple yet effective approach capable of improving training speed, sampling speed, and generation quality simultaneously. Unlike DDPM, which trains the image denoiser across 1,000 time steps, Fast-DDPM trains and samples using only 10 time steps. The key to our method lies in aligning the training and sampling procedures to optimize time-step utilization. Specifically, we introduced two efficient noise schedulers with 10 time steps: one with uniform time step sampling and another with non-uniform sampling. We evaluated Fast-DDPM across three medical image-to-image generation tasks: multi-image super-resolution, image denoising, and image-to-image translation. Fast-DDPM outperformed DDPM and current state-of-the-art methods based on convolutional networks and generative adversarial networks in all tasks. Additionally, Fast-DDPM reduced the training time to 0.2x and the sampling time to 0.01x compared to DDPM.
|
14 |
+
|
15 |
+
<p align="center">
|
16 |
+
<img src="https://github.com/mirthAI/Fast-DDPM/raw/main/Overview.png" alt="DDPM vs. Fast-DDPM" width="750">
|
17 |
+
</p>
|
18 |
+
|
19 |
+
## Usage
|
20 |
+
|
21 |
+
For complete instructions, please refer to the [official GitHub repository](https://github.com/mirthAI/Fast-DDPM).
|
22 |
+
|
23 |
+
### Requirements
|
24 |
+
* Python==3.10.6
|
25 |
+
* torch==1.12.1
|
26 |
+
* torchvision==0.15.2
|
27 |
+
* numpy
|
28 |
+
* opencv-python
|
29 |
+
* tqdm
|
30 |
+
* tensorboard
|
31 |
+
* tensorboardX
|
32 |
+
* scikit-image
|
33 |
+
* medpy
|
34 |
+
* pillow
|
35 |
+
* scipy
|
36 |
+
* `pip install -r requirements.txt`
|
37 |
+
|
38 |
+
### Publicly available Dataset
|
39 |
+
- Prostate-MRI-US-Biopsy dataset
|
40 |
+
- LDCT-and-Projection-data dataset
|
41 |
+
- BraTS 2018 dataset
|
42 |
+
- The processed dataset can be accessed here: https://drive.google.com/file/d/1kF0g8fMR5XPQ2FTbutfTQ-hwG_mTqerx/view?usp=drive_link.
|
43 |
+
|
44 |
+
### 1. Git clone or download the codes.
|
45 |
+
|
46 |
+
### 2. Pretrained model weights
|
47 |
+
* We provide pretrained model weights for all three tasks, where you can access them here: https://drive.google.com/file/d/1ndS-eLegqwCOUoLT1B-HQiqRQqZUMKVF/view?usp=sharing.
|
48 |
+
* Pretrained model weights are also available on [Hugging Face](https://huggingface.co/SebastianJiang/FastDDPM).
|
49 |
+
* As shown in ablation study, the defaulted 10 time steps may not be optimal for every task, you're more welcome to train Fast-DDPM model on your dataset using different settings.
|
50 |
+
|
51 |
+
### 3. Prepare data
|
52 |
+
* Please download our processed dataset or download from the official websites.
|
53 |
+
* After downloading, extract the file and put it into folder "data/". The directory structure should be as follows:
|
54 |
+
|
55 |
+
```bash
|
56 |
+
├── configs
|
57 |
+
│
|
58 |
+
├── data
|
59 |
+
│ ├── LD_FD_CT_train
|
60 |
+
│ ├── LD_FD_CT_test
|
61 |
+
│ ├── PMUB-train
|
62 |
+
│ ├── PMUB-test
|
63 |
+
│ ├── Brats_train
|
64 |
+
│ └── Brats_test
|
65 |
+
│
|
66 |
+
├── datasets
|
67 |
+
│
|
68 |
+
├── functions
|
69 |
+
│
|
70 |
+
├── models
|
71 |
+
│
|
72 |
+
└── runners
|
73 |
+
|
74 |
+
```
|
75 |
+
|
76 |
+
### 4. Training/Sampling a Fast-DDPM model
|
77 |
+
* Please make sure that the hyperparameters such as scheduler type and timesteps are consistent between training and sampling.
|
78 |
+
* The total number of time steps is defaulted as 1000 in the paper, so the number of involved time steps for Fast-DDPM should be less than 1000 as an integer.
|
79 |
+
```
|
80 |
+
python fast_ddpm_main.py --config {DATASET}.yml --dataset {DATASET_NAME} --exp {PROJECT_PATH} --doc {MODEL_NAME} --scheduler_type {SAMPLING STRATEGY} --timesteps {STEPS}
|
81 |
+
```
|
82 |
+
```
|
83 |
+
python fast_ddpm_main.py --config {DATASET}.yml --dataset {DATASET_NAME} --exp {PROJECT_PATH} --doc {MODEL_NAME} --sample --fid --scheduler_type {SAMPLING STRATEGY} --timesteps {STEPS}
|
84 |
+
```
|
85 |
+
|
86 |
+
where
|
87 |
+
- `DATASET_NAME` should be selected among `LDFDCT` for image denoising task, `BRATS` for image-to-image translation task and `PMUB` for multi image super-resolution task.
|
88 |
+
- `SAMPLING STRATEGY` controls the scheduler sampling strategy proposed in the paper (either uniform or non-uniform).
|
89 |
+
- `STEPS` controls how many timesteps used in the training and inference process. It should be an integer less than 1000 for Fast-DDPM, which is 10 by default.
|
90 |
+
|
91 |
+
|
92 |
+
### 5. Training/Sampling a DDPM model
|
93 |
+
* Please make sure that the hyperparameters such as scheduler type and timesteps are consistent between training and sampling.
|
94 |
+
* The total number of time steps is defaulted as 1000 in the paper, so the number of time steps for DDPM is defaulted as 1000.
|
95 |
+
```
|
96 |
+
python ddpm_main.py --config {DATASET}.yml --dataset {DATASET_NAME} --exp {PROJECT_PATH} --doc {MODEL_NAME} --timesteps {STEPS}
|
97 |
+
```
|
98 |
+
```
|
99 |
+
python ddpm_main.py --config {DATASET}.yml --dataset {DATASET_NAME} --exp {PROJECT_PATH} --doc {MODEL_NAME} --sample --fid --timesteps {STEPS}
|
100 |
+
```
|
101 |
+
|
102 |
+
where
|
103 |
+
- `DATASET_NAME` should be selected among `LDFDCT` for image denoising task, `BRATS` for image-to-image translation task and `PMUB` for multi image super-resolution task.
|
104 |
+
- `STEPS` controls how many timesteps used in the training and inference process. It should be 1000 in the setting of this paper.
|
105 |
+
|
106 |
+
## Citation
|
107 |
+
If you use our code or dataset, please cite our paper as below:
|
108 |
+
```bibtex
|
109 |
+
@article{jiang2025fast,
|
110 |
+
title={Fast-DDPM: Fast denoising diffusion probabilistic models for medical image-to-image generation},
|
111 |
+
author={Jiang, Hongxu and Imran, Muhammad and Zhang, Teng and Zhou, Yuyin and Liang, Muxuan and Gong, Kuang and Shao, Wei},
|
112 |
+
journal={IEEE Journal of Biomedical and Health Informatics},
|
113 |
+
year={2025},
|
114 |
+
publisher={IEEE}
|
115 |
+
}
|
116 |
+
```
|