rddm 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
rddm-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Jianxu Wang
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
rddm-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,218 @@
1
+ Metadata-Version: 2.4
2
+ Name: rddm
3
+ Version: 0.1.0
4
+ Summary: RDDM: A Residual-Driven Drifting Model for High-Fidelity Low-Dose CT Denoising
5
+ Author: Jianxu Wang, Qing Lyu, Ge Wang
6
+ Project-URL: Paper, https://arxiv.org/abs/2605.17188
7
+ Project-URL: Homepage, https://github.com/Jayx-Wang/RDDM
8
+ Project-URL: Team, https://wang-axis.github.io/
9
+ Requires-Python: >=3.8
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Requires-Dist: numpy
13
+ Requires-Dist: pydicom
14
+ Requires-Dist: Pillow
15
+ Requires-Dist: scikit-image
16
+ Requires-Dist: tqdm
17
+ Requires-Dist: pytorch-fid
18
+ Dynamic: license-file
19
+
20
+ # RDDM: A Residual-Driven Drifting Model for High-Fidelity Low-Dose CT Denoising
21
+
22
+ [![arXiv](https://img.shields.io/badge/arXiv-2605.17188-b31b1b.svg)](https://arxiv.org/abs/2605.17188)
23
+
24
+ Official code release for **RDDM: A Residual-Driven Drifting Model for High-Fidelity Low-Dose CT Denoising** by Jianxu Wang, Qing Lyu, and Ge Wang.
25
+
26
+ > Our Team: [WANG-AXIS Lab](https://wang-axis.github.io/)
27
+
28
+ ## Introduction
29
+
30
+ RDDM is an efficient and high-fidelity LDCT denoising method based on a residual-driven drifting model. It incorporates the multi-step evolution from the generated residual distribution to the real residual distribution into the training dynamics through a residual drifting field, thereby enabling one-step denoising at inference time. Experiments on clinical datasets show that RDDM achieves state-of-the-art denoising performance among supervised baselines.
31
+
32
+ <p align="center">
33
+ <img src="assets/overview.png" alt="Overview of the RDDM training framework" width="100%">
34
+ </p>
35
+
36
+ <p align="center"><em>Fig. 1. Overview of RDDM. The top panel shows the training framework: the denoiser generates residual samples, while the objective is computed from the full generated residual batch and real residual batch. The bottom panels illustrate training-time drifting toward the real residual distribution and summarize the three RDDM variants.</em></p>
37
+
38
+
39
+ ## RDDM Variants
40
+
41
+ The paper reports three RDDM variants, providing practical choices from fine-detail fidelity to stronger noise suppression. They share the same RDDM framework; only the drifting temperatures and optional pixel-level L1 supervision differ.
42
+
43
+ | Variant | `--temperatures` | `--lambda_l1` | Intended use | Pretrained weights |
44
+ | --- | --- | ---: | --- | --- |
45
+ | RDDM-Fine | `1.0,1.5` | `0` | Best fidelity; preserves realistic anatomical texture and noise characteristics. | [Download](https://drive.google.com/file/d/1WO0imP0_8diJX0MXQTZlhe1jrkfgwAHz/view?usp=drive_link) |
46
+ | RDDM-Balanced | `0.2,1.0` | `0` | Default trade-off between noise suppression and detail preservation. | [Download](https://drive.google.com/file/d/1U4ikII3xSH30jDfFInfINM5K-CTTRMex/view?usp=drive_link) |
47
+ | RDDM-Smooth | `1.0` | `0.01` | Stronger noise suppression with smoother reconstructions. | [Download](https://drive.google.com/file/d/1YcWiFCyKodjx9L76q4MaEWCfUMyIU1K4/view?usp=drive_link) |
48
+
49
+ * _The training and test sets strictly follow the split described in the paper and are kept independent throughout model training and inference._
50
+ * _Place the downloaded pretrained weights under the corresponding subfolders in `checkpoints/`._
51
+
52
+ ## Installation
53
+
54
+ Tested environment:
55
+
56
+ - Python `3.10.20`
57
+ - PyTorch `2.6.0+cu124`
58
+ - CUDA `12.4`
59
+
60
+ Create a clean environment first:
61
+
62
+ ```bash
63
+ conda create -n rddm python=3.10 -y
64
+ conda activate rddm
65
+ python -m pip install -U pip
66
+ ```
67
+
68
+ Install a PyTorch build matching your CUDA version. For example, for CUDA 12.4:
69
+
70
+ ```bash
71
+ pip install torch==2.6.0 --index-url https://download.pytorch.org/whl/cu124
72
+ ```
73
+
74
+ For other CUDA/CPU targets, use the [official PyTorch instructions](https://pytorch.org/get-started/locally/).
75
+
76
+ ### Option 1: Install from source
77
+
78
+ ```bash
79
+ git clone https://github.com/Jayx-Wang/RDDM.git
80
+ cd RDDM
81
+ pip install -e .
82
+ ```
83
+
84
+ ### Option 2: Install the RDDM CLI
85
+
86
+ ```bash
87
+ pip install rddm
88
+ ```
89
+
90
+ After installation, the following commands are available:
91
+
92
+ ```bash
93
+ rddm-train --help
94
+ rddm-infer-single --help
95
+ rddm-evaluate --help
96
+ ```
97
+
98
+ ## Data Preparation
99
+
100
+ The clinical dataset used in this work can be obtained from the official [AAPM Low Dose CT Grand Challenge](https://www.aapm.org/grandchallenge/lowdosect/) page. We use the subset reconstructed with the B30 kernel and a slice thickness of 1 mm.
101
+
102
+ The expected directory layout is:
103
+
104
+ ```text
105
+ path/to/the/dataset/
106
+ ├── train/
107
+ │ ├── ldct/
108
+ │ │ ├── *.IMA
109
+ │ │ └── ...
110
+ │ └── ndct/
111
+ │ ├── *.IMA
112
+ │ └── ...
113
+ └── test/
114
+ ├── ldct/
115
+ │ ├── *.IMA
116
+ │ └── ...
117
+ └── ndct/
118
+ ├── *.IMA
119
+ └── ...
120
+ ```
121
+
122
+ Use `--data_dir /path/to/the/dataset` to specify your own dataset. Please ensure that LDCT and NDCT files are paired by matching filenames under the corresponding `ldct/` and `ndct/` folders.
123
+
124
+
125
+ ## Quick Start
126
+
127
+ The commands below are for installation from source and should be run inside the cloned repository. If you use the CLI installation, check `rddm-train --help`, `rddm-infer-single --help`, and `rddm-evaluate --help` for the corresponding usage.
128
+
129
+ ### Train RDDM-Fine
130
+
131
+ The following example trains RDDM-Fine with `--temperatures 1.0,1.5` and `--lambda_l1 0`. To train RDDM-Balanced or RDDM-Smooth manually, keep the same command structure and change the variant-specific arguments shown in the table above.
132
+
133
+ ```bash
134
+ CUDA_VISIBLE_DEVICES=0 python train.py \
135
+ --data_dir /path/to/the/dataset \
136
+ --split_train train \
137
+ --batch_size 24 \
138
+ --ncpus 8 \
139
+ --lr 1e-4 \
140
+ --lr_decay_mode step \
141
+ --lr_decay_step 10000 \
142
+ --lr_decay_gamma 0.5 \
143
+ --max_steps 50000 \
144
+ --save_interval 10000 \
145
+ --use_fp16 false \
146
+ --max_norm 1.0 \
147
+ --temperatures 1.0,1.5 \
148
+ --lambda_l1 0 \
149
+ --checkpointdir checkpoints/Custom/RDDM-Fine
150
+ ```
151
+
152
+ * _Replace `/path/to/the/dataset` with the path to your prepared dataset._
153
+
154
+ * _Please adjust settings such as `--batch_size`, `--ncpus`, and precision according to your own GPU memory and hardware setup._
155
+ * _For multi-GPU training, launch with `torchrun` and keep the same script arguments._
156
+
157
+ ### Easily Reproduce Our RDDM Variants
158
+
159
+ ```bash
160
+ DATA_DIR=/path/to/the/dataset GPU=0 bash scripts/train_rddm_fine.sh
161
+ DATA_DIR=/path/to/the/dataset GPU=0 bash scripts/train_rddm_balanced.sh
162
+ DATA_DIR=/path/to/the/dataset GPU=0 bash scripts/train_rddm_smooth.sh
163
+ ```
164
+
165
+ * _Replace `/path/to/the/dataset` with the path to your prepared dataset._
166
+ * _The default training parameters are configured for a single H100 80GB GPU._
167
+
168
+ ### Single-Slice Inference
169
+
170
+ ```bash
171
+ CUDA_VISIBLE_DEVICES=0 python infer_single.py \
172
+ --ldct_path test_sample/ldct/L506_0081.IMA \
173
+ --ndct_path test_sample/ndct/L506_0081.IMA \
174
+ --checkpoint checkpoints/RDDM-Fine/rddm_fine_050000.pth \
175
+ --hu_min -1024 \
176
+ --hu_max 3072 \
177
+ --window_center 40 \
178
+ --window_width 400 \
179
+ --use_fp16 false \
180
+ --save_images true \
181
+ --out_dir outputs/single_L506_0081
182
+ ```
183
+
184
+
185
+ ### Dataset Evaluation
186
+
187
+ ```bash
188
+ CUDA_VISIBLE_DEVICES=0 python evaluate.py \
189
+ --data_dir /path/to/the/dataset \
190
+ --split test \
191
+ --checkpoint checkpoints/RDDM-Fine/rddm_fine_050000.pth \
192
+ --hu_min -1024 \
193
+ --hu_max 3072 \
194
+ --use_fp16 false \
195
+ --num_test_samples 1 \
196
+ --compute_fid true \
197
+ --fid_batch_size 50 \
198
+ --fid_dims 2048 \
199
+ --fid_num_workers 8 \
200
+ --save_npy true \
201
+ --out_dir outputs/evaluate_rddm_fine
202
+ ```
203
+
204
+ * _Replace `/path/to/the/dataset` with the path to your prepared dataset._
205
+
206
+ ## Citation
207
+
208
+ If you use this code, please cite the paper below.
209
+
210
+ ```bibtex
211
+ @article{wang2026rddm,
212
+ title={RDDM: A Residual-Driven Drifting Model for High-Fidelity Low-Dose CT Denoising},
213
+ author={Wang, Jianxu and Lyu, Qing and Wang, Ge},
214
+ journal={arXiv preprint arXiv:2605.17188},
215
+ year={2026}
216
+ }
217
+ ```
218
+
rddm-0.1.0/README.md ADDED
@@ -0,0 +1,199 @@
1
+ # RDDM: A Residual-Driven Drifting Model for High-Fidelity Low-Dose CT Denoising
2
+
3
+ [![arXiv](https://img.shields.io/badge/arXiv-2605.17188-b31b1b.svg)](https://arxiv.org/abs/2605.17188)
4
+
5
+ Official code release for **RDDM: A Residual-Driven Drifting Model for High-Fidelity Low-Dose CT Denoising** by Jianxu Wang, Qing Lyu, and Ge Wang.
6
+
7
+ > Our Team: [WANG-AXIS Lab](https://wang-axis.github.io/)
8
+
9
+ ## Introduction
10
+
11
+ RDDM is an efficient and high-fidelity LDCT denoising method based on a residual-driven drifting model. It incorporates the multi-step evolution from the generated residual distribution to the real residual distribution into the training dynamics through a residual drifting field, thereby enabling one-step denoising at inference time. Experiments on clinical datasets show that RDDM achieves state-of-the-art denoising performance among supervised baselines.
12
+
13
+ <p align="center">
14
+ <img src="assets/overview.png" alt="Overview of the RDDM training framework" width="100%">
15
+ </p>
16
+
17
+ <p align="center"><em>Fig. 1. Overview of RDDM. The top panel shows the training framework: the denoiser generates residual samples, while the objective is computed from the full generated residual batch and real residual batch. The bottom panels illustrate training-time drifting toward the real residual distribution and summarize the three RDDM variants.</em></p>
18
+
19
+
20
+ ## RDDM Variants
21
+
22
+ The paper reports three RDDM variants, providing practical choices from fine-detail fidelity to stronger noise suppression. They share the same RDDM framework; only the drifting temperatures and optional pixel-level L1 supervision differ.
23
+
24
+ | Variant | `--temperatures` | `--lambda_l1` | Intended use | Pretrained weights |
25
+ | --- | --- | ---: | --- | --- |
26
+ | RDDM-Fine | `1.0,1.5` | `0` | Best fidelity; preserves realistic anatomical texture and noise characteristics. | [Download](https://drive.google.com/file/d/1WO0imP0_8diJX0MXQTZlhe1jrkfgwAHz/view?usp=drive_link) |
27
+ | RDDM-Balanced | `0.2,1.0` | `0` | Default trade-off between noise suppression and detail preservation. | [Download](https://drive.google.com/file/d/1U4ikII3xSH30jDfFInfINM5K-CTTRMex/view?usp=drive_link) |
28
+ | RDDM-Smooth | `1.0` | `0.01` | Stronger noise suppression with smoother reconstructions. | [Download](https://drive.google.com/file/d/1YcWiFCyKodjx9L76q4MaEWCfUMyIU1K4/view?usp=drive_link) |
29
+
30
+ * _The training and test sets strictly follow the split described in the paper and are kept independent throughout model training and inference._
31
+ * _Place the downloaded pretrained weights under the corresponding subfolders in `checkpoints/`._
32
+
33
+ ## Installation
34
+
35
+ Tested environment:
36
+
37
+ - Python `3.10.20`
38
+ - PyTorch `2.6.0+cu124`
39
+ - CUDA `12.4`
40
+
41
+ Create a clean environment first:
42
+
43
+ ```bash
44
+ conda create -n rddm python=3.10 -y
45
+ conda activate rddm
46
+ python -m pip install -U pip
47
+ ```
48
+
49
+ Install a PyTorch build matching your CUDA version. For example, for CUDA 12.4:
50
+
51
+ ```bash
52
+ pip install torch==2.6.0 --index-url https://download.pytorch.org/whl/cu124
53
+ ```
54
+
55
+ For other CUDA/CPU targets, use the [official PyTorch instructions](https://pytorch.org/get-started/locally/).
56
+
57
+ ### Option 1: Install from source
58
+
59
+ ```bash
60
+ git clone https://github.com/Jayx-Wang/RDDM.git
61
+ cd RDDM
62
+ pip install -e .
63
+ ```
64
+
65
+ ### Option 2: Install the RDDM CLI
66
+
67
+ ```bash
68
+ pip install rddm
69
+ ```
70
+
71
+ After installation, the following commands are available:
72
+
73
+ ```bash
74
+ rddm-train --help
75
+ rddm-infer-single --help
76
+ rddm-evaluate --help
77
+ ```
78
+
79
+ ## Data Preparation
80
+
81
+ The clinical dataset used in this work can be obtained from the official [AAPM Low Dose CT Grand Challenge](https://www.aapm.org/grandchallenge/lowdosect/) page. We use the subset reconstructed with the B30 kernel and a slice thickness of 1 mm.
82
+
83
+ The expected directory layout is:
84
+
85
+ ```text
86
+ path/to/the/dataset/
87
+ ├── train/
88
+ │ ├── ldct/
89
+ │ │ ├── *.IMA
90
+ │ │ └── ...
91
+ │ └── ndct/
92
+ │ ├── *.IMA
93
+ │ └── ...
94
+ └── test/
95
+ ├── ldct/
96
+ │ ├── *.IMA
97
+ │ └── ...
98
+ └── ndct/
99
+ ├── *.IMA
100
+ └── ...
101
+ ```
102
+
103
+ Use `--data_dir /path/to/the/dataset` to specify your own dataset. Please ensure that LDCT and NDCT files are paired by matching filenames under the corresponding `ldct/` and `ndct/` folders.
104
+
105
+
106
+ ## Quick Start
107
+
108
+ The commands below are for installation from source and should be run inside the cloned repository. If you use the CLI installation, check `rddm-train --help`, `rddm-infer-single --help`, and `rddm-evaluate --help` for the corresponding usage.
109
+
110
+ ### Train RDDM-Fine
111
+
112
+ The following example trains RDDM-Fine with `--temperatures 1.0,1.5` and `--lambda_l1 0`. To train RDDM-Balanced or RDDM-Smooth manually, keep the same command structure and change the variant-specific arguments shown in the table above.
113
+
114
+ ```bash
115
+ CUDA_VISIBLE_DEVICES=0 python train.py \
116
+ --data_dir /path/to/the/dataset \
117
+ --split_train train \
118
+ --batch_size 24 \
119
+ --ncpus 8 \
120
+ --lr 1e-4 \
121
+ --lr_decay_mode step \
122
+ --lr_decay_step 10000 \
123
+ --lr_decay_gamma 0.5 \
124
+ --max_steps 50000 \
125
+ --save_interval 10000 \
126
+ --use_fp16 false \
127
+ --max_norm 1.0 \
128
+ --temperatures 1.0,1.5 \
129
+ --lambda_l1 0 \
130
+ --checkpointdir checkpoints/Custom/RDDM-Fine
131
+ ```
132
+
133
+ * _Replace `/path/to/the/dataset` with the path to your prepared dataset._
134
+
135
+ * _Please adjust settings such as `--batch_size`, `--ncpus`, and precision according to your own GPU memory and hardware setup._
136
+ * _For multi-GPU training, launch with `torchrun` and keep the same script arguments._
137
+
138
+ ### Easily Reproduce Our RDDM Variants
139
+
140
+ ```bash
141
+ DATA_DIR=/path/to/the/dataset GPU=0 bash scripts/train_rddm_fine.sh
142
+ DATA_DIR=/path/to/the/dataset GPU=0 bash scripts/train_rddm_balanced.sh
143
+ DATA_DIR=/path/to/the/dataset GPU=0 bash scripts/train_rddm_smooth.sh
144
+ ```
145
+
146
+ * _Replace `/path/to/the/dataset` with the path to your prepared dataset._
147
+ * _The default training parameters are configured for a single H100 80GB GPU._
148
+
149
+ ### Single-Slice Inference
150
+
151
+ ```bash
152
+ CUDA_VISIBLE_DEVICES=0 python infer_single.py \
153
+ --ldct_path test_sample/ldct/L506_0081.IMA \
154
+ --ndct_path test_sample/ndct/L506_0081.IMA \
155
+ --checkpoint checkpoints/RDDM-Fine/rddm_fine_050000.pth \
156
+ --hu_min -1024 \
157
+ --hu_max 3072 \
158
+ --window_center 40 \
159
+ --window_width 400 \
160
+ --use_fp16 false \
161
+ --save_images true \
162
+ --out_dir outputs/single_L506_0081
163
+ ```
164
+
165
+
166
+ ### Dataset Evaluation
167
+
168
+ ```bash
169
+ CUDA_VISIBLE_DEVICES=0 python evaluate.py \
170
+ --data_dir /path/to/the/dataset \
171
+ --split test \
172
+ --checkpoint checkpoints/RDDM-Fine/rddm_fine_050000.pth \
173
+ --hu_min -1024 \
174
+ --hu_max 3072 \
175
+ --use_fp16 false \
176
+ --num_test_samples 1 \
177
+ --compute_fid true \
178
+ --fid_batch_size 50 \
179
+ --fid_dims 2048 \
180
+ --fid_num_workers 8 \
181
+ --save_npy true \
182
+ --out_dir outputs/evaluate_rddm_fine
183
+ ```
184
+
185
+ * _Replace `/path/to/the/dataset` with the path to your prepared dataset._
186
+
187
+ ## Citation
188
+
189
+ If you use this code, please cite the paper below.
190
+
191
+ ```bibtex
192
+ @article{wang2026rddm,
193
+ title={RDDM: A Residual-Driven Drifting Model for High-Fidelity Low-Dose CT Denoising},
194
+ author={Wang, Jianxu and Lyu, Qing and Wang, Ge},
195
+ journal={arXiv preprint arXiv:2605.17188},
196
+ year={2026}
197
+ }
198
+ ```
199
+
File without changes