Official implementation of metal artifact reduction for the paper:
Elucidating the Design Space of Arbitrary-Noise-Based Diffusion Models (EDA)
Xingyu Qiu, Mengying Yang, Xinghua Ma, Dong Liang, Fanding Li, Gongning Luo, Wei Wang, Kuanquan Wang, Shuo Li
CVPR 2026
MAR is Task 2 in EDA: it removes metal streak artifacts from CT by diffusing sample-dependent basis noise h = X_ma − x_0 (EDA Case 2, η = 10), with a metal-aware weighted loss.
This module is built on top of the Denoising Diffusion Implicit Models (DDIM) PyTorch codebase. We thank Jiaming Song, Chenlin Meng, and Stefano Ermon for releasing their implementation.
Original DDIM repository: https://github.com/ermongroup/ddim
| Item | Setting |
|---|---|
| Basis | Sample-dependent h = X_ma − x_0 |
| EDA case | Case 2 — sample-dependent basis |
| η (training noise) | 10: N = (10 + ε) / 11 · h, ε ~ N(0,1) |
| Forward process | s(t) = 1, σ(t) = √(1 − ᾱ_t) |
| Loss | Weighted MSE with metal mask m (Appendix E.3) |
| Input size | 416 × 416, grayscale |
| Optimizer | Adam, lr = 1×10⁻⁵, EMA = 0.9999 |
| Training | 1000 epochs, batch size 1 |
| Sampling | 5-step deterministic Euler, η = 0 |
MAR/
├── main.py # Entry point (train / sample)
├── configs/mydataset.yml # MAR hyperparameters
├── runners/diffusion.py # EDA MAR training & sampling
├── functions/
│ ├── losses.py # Weighted noise-prediction loss
│ └── denoising.py # Deterministic sampling steps
├── datasets/
│ └── data_loading.py # MARTrainDataset (pre-simulated h5 pairs)
└── models/diffusion.py # UNet denoiser (from DDIM)
This module is built on DDIM. Install Python, PyTorch, and other dependencies according to the baseline repository:
Baseline GitHub: https://github.com/ermongroup/ddim
Training and testing use pre-simulated SynDeepLesion pairs stored as HDF5 files:
data/SynDeepLesion/
├── trainmask.npy
├── train_640geo_dir.txt
├── test_640geo_dir.txt
├── train_640geo/ # GT *.h5 and ma_CT *.h5
└── test_640geo/
Each volume has paired image (GT) and ma_CT (metal-affected) arrays. Set data.data_root in configs/mydataset.yml or pass --data_root at runtime.
Train
python main.py --config mydataset.yml --exp exp --doc mar_eda --niSample
python main.py --config mydataset.yml --exp exp --doc mar_eda --sample --sequence --timesteps 5 --niSee arg.txt for additional command examples.
@inproceedings{qiu2026eda,
title={Elucidating the Design Space of Arbitrary-Noise-Based Diffusion Models},
author={Qiu, Xingyu and Yang, Mengying and Ma, Xinghua and others},
booktitle={CVPR},
year={2026}
}