Official implementation of shadow removal for the paper:
Elucidating the Design Space of Arbitrary-Noise-Based Diffusion Models (EDA)
CVPR 2026
SR is Task 3 in EDA: it removes shadows using sample-dependent basis noise h = X_S − x_0 (EDA Case 2, η = 10), built on the ShadowFormer backbone.
This module extends the ShadowFormer (AAAI 2023) codebase with EDA generalized diffusion training and multi-step deterministic sampling. We thank the ShadowFormer authors for releasing their implementation.
The overall diffusion scheduling follows the DDIM codebase used in other EDA tasks.
| Item | Setting |
|---|---|
| Basis | Sample-dependent h = X_S − x_0 |
| EDA case | Case 2 — sample-dependent basis |
| η (training noise) | 10: N = (10 + ε) / 11 · h, ε ~ N(0,1) |
| Forward process | x_t = x_0 + √(1 − ᾱ_t) · N |
| Mask conditioning | mask_t = m · √(1 − ᾱ_t) (Appendix E.4) |
| Training target | ShadowFormer predicts x_0 directly |
| Loss | L_SR = 𝔼 ‖x_θ(x_t, t) − x_0‖² (Charbonnier in code) |
| Diffusion steps T | 100 (linear β: 0.0001 → 0.02) |
| Input size | 320 × 320 × 3 |
| Optimizer | AdamW (ShadowFormer default), lr = 2×10⁻⁴ |
| Training | 2000 epochs, batch size 4 |
| Sampling | 5-step deterministic Euler from shadow image X_S |
shadow/
├── train_df.py # EDA + ShadowFormer training
├── test_df.py # 5-step deterministic inference
├── options.py # Training hyperparameters
├── model.py # ShadowFormer architecture
├── dataset.py # ISTD / ISTD+ data loader
├── losses.py
├── utils/ # Data loading, checkpoints, metrics
├── warmup_scheduler/ # LR warmup (ShadowFormer official)
├── arg.txt
└── evaluation/ # MATLAB metrics (measure_shadow.m)
This module extends ShadowFormer. Install Python, PyTorch, and other dependencies according to the baseline repository:
Baseline GitHub: https://github.com/GuoLanqing/ShadowFormer
A local requirements.txt is included for reference and matches the ShadowFormer stack.
Use the ISTD dataset layout:
ISTD_Dataset/
├── train/
│ ├── train_A/ # shadow images (X_S)
│ ├── train_B/ # shadow masks
│ └── train_C/ # shadow-free GT (x_0)
└── test/
├── test_A/
├── test_B/
└── test_C/
Train (EDA)
python train_df.py --train_dir ./ISTD_Dataset/train --val_dir ./ISTD_Dataset/testSample / Evaluate
python test_df.py \
--input_dir ./ISTD_Dataset/test \
--weights ./log/ShadowFormer_istd/models/model_best.pth \
--times 5 \
--save_images \
--cal_metricsSee arg.txt for additional 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}
}
@article{guo2023shadowformer,
title={ShadowFormer: Global Context Helps Image Shadow Removal},
author={Guo, Lan and Huang, Song and Liu, Dong and Cheng, Hao and Wen, Bihan},
journal={AAAI},
year={2023}
}