File size: 10,593 Bytes
23c5b5f
 
 
 
0f673c6
23c5b5f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2d48846
23c5b5f
2d48846
 
8c69cf0
2d48846
23c5b5f
2d48846
8c69cf0
23c5b5f
2d48846
 
 
 
 
 
8c69cf0
2d48846
23c5b5f
2d48846
23c5b5f
 
 
 
 
8c69cf0
23c5b5f
 
8c69cf0
 
 
23c5b5f
 
 
 
8c69cf0
 
 
 
23c5b5f
 
8c69cf0
 
23c5b5f
8c69cf0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23c5b5f
 
 
8c69cf0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23c5b5f
2d48846
23c5b5f
8c69cf0
 
 
 
 
 
23c5b5f
 
8c69cf0
23c5b5f
 
 
 
 
 
 
 
 
8c69cf0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23c5b5f
 
 
 
 
 
 
8c69cf0
 
 
23c5b5f
8c69cf0
 
 
23c5b5f
 
 
 
 
 
 
 
8c69cf0
 
 
 
 
 
 
 
 
23c5b5f
8c69cf0
 
 
23c5b5f
 
 
 
 
 
8c69cf0
23c5b5f
8c69cf0
 
23c5b5f
8c69cf0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23c5b5f
8c69cf0
23c5b5f
2d48846
23c5b5f
 
 
 
 
 
 
 
 
 
8c69cf0
2d48846
8c69cf0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23c5b5f
8c69cf0
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
---
license: apache-2.0
base_model: Wan-AI/Wan2.1-VACE-14B
base_model_relation: adapter
pipeline_tag: video-to-video
tags:
  - lora
  - safetensors
  - diffsynth
  - diffusion
  - video-to-video
  - image-to-image
  - hdr
  - ldr-to-hdr
  - inverse-tone-mapping
  - panorama
  - wan2.1
  - vace
---

# DiffHDR: Re-Exposing LDR Videos with Video Diffusion Models (ECCV 2026)

[![Project Page](https://img.shields.io/badge/Project-Page-yellow?logo=googlechrome&logoColor=yellow)](https://eyeline-labs.github.io/DiffHDR/)
[![Paper](https://img.shields.io/badge/Paper-arXiv-b31b1b?logo=arxiv&logoColor=red)](https://arxiv.org/abs/2604.06161)
[![Hugging Face](https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-DiffHDR-blue)](https://huggingface.co/ZhengmingYu/DiffHDR)
[![Demo Video](https://img.shields.io/badge/Demo-Video-red?logo=youtube&logoColor=white)](https://youtu.be/kq8qZfwBRs0)

[Zhengming Yu](https://yzmblog.github.io/)<sup>1,2</sup>, [Li Ma](https://limacv.github.io/homepage/)<sup>2</sup>, [Mingming He](https://mingminghe.com/)<sup>2</sup>, [Leo Isikdogan](https://isikdogan.com/)<sup>3</sup>, [Yuancheng Xu](https://yuancheng-xu.github.io/)<sup>2,3</sup>, [Dmitriy Smirnov](https://dsmirnov.com/)<sup>3</sup>, [Pablo Salamanca](https://pablosalaman.ca/)<sup>2,3</sup>, [Dao Mi](#)<sup>3</sup>, [Pablo Delgado](#)<sup>3</sup>, [Ning Yu](https://ningyu1991.github.io/)<sup>2,3</sup>, [Julien Philip](https://julienphilip.com/)<sup>2</sup>, [Xin Li](https://people.tamu.edu/~xinli/)<sup>1</sup>, [Wenping Wang](https://engineering.tamu.edu/cse/profiles/Wang-Wenping.html)<sup>1</sup>, [Paul Debevec](https://www.debevec.org/)<sup>2,3</sup><br/>
<sup>1</sup>Texas A&amp;M University, <sup>2</sup>Eyeline Labs, <sup>3</sup>Netflix<br/>

<p align="center">
  <img src="./assets/teaser.png" alt="DiffHDR teaser figure">
</p>

## πŸ“ Abstract

> Most digital videos are stored in 8-bit low dynamic range (LDR) formats, where much of the original high dynamic range (HDR) scene radiance is lost due to saturation and quantization. This loss of highlight and shadow detail precludes mapping accurate luminance to HDR displays and limits meaningful re-exposure in post-production workflows. Although techniques have been proposed to convert LDR images to HDR through dynamic range expansion, they struggle to restore realistic detail in over- and underexposed regions. To address this, we present **DiffHDR**, a framework that formulates LDR-to-HDR conversion as a generative radiance inpainting task in the latent space of a video diffusion model. By operating in Log-Gamma color space, DiffHDR leverages spatio-temporal generative priors from a pretrained video diffusion model to synthesize plausible HDR radiance in over- and underexposed regions while recovering the continuous scene radiance. Our framework further enables controllable LDR-to-HDR video conversion guided by text prompts or reference images. To address the scarcity of paired HDR video data, we develop a pipeline that synthesizes high-quality HDR video training data from static HDRI maps. Extensive experiments demonstrate that DiffHDR significantly outperforms state-of-the-art approaches in radiance fidelity and temporal stability, producing realistic HDR videos with considerable latitude for re-exposure.


## πŸ› οΈ Setup

```bash
conda create -n diffhdr python=3.10 -y
conda activate diffhdr

# Install PyTorch (CUDA 11.8)
pip install torch==2.6.0 torchvision==0.21.0 torchaudio==2.6.0 \
    --index-url https://download.pytorch.org/whl/cu118

# Install DiffHDR
cd /path/to/DiffHDR_Code
pip install -e .
pip install -r requirements.txt
```

### Base model

Download Wan2.1-VACE-14B (~75 GB). This single repo contains everything needed --
the 7 DiT shards, the T5 text encoder, the VAE, and the umt5-xxl tokenizer:

```bash
hf download Wan-AI/Wan2.1-VACE-14B --local-dir models/Wan-AI/Wan2.1-VACE-14B
```

Expected layout:

```
models/Wan-AI/Wan2.1-VACE-14B/
β”œβ”€β”€ diffusion_pytorch_model-0000{1..7}-of-00007.safetensors
β”œβ”€β”€ models_t5_umt5-xxl-enc-bf16.pth
β”œβ”€β”€ Wan2.1_VAE.pth
└── google/umt5-xxl/
```

Set the `MODEL_BASE` environment variable to point the scripts at a different
root instead of `models/`.

### LoRA checkpoints

```bash
mkdir -p models
hf download ZhengmingYu/DiffHDR --local-dir models
```

This fetches both LoRA weights (58 MB each) into `models/`:

| File | Use with |
|------|----------|
| `DiffHDR.safetensors` | `infer_video.py`, `infer_image.py`, `infer_long_video.py` |
| `DiffHDR_Pano.safetensors` | `infer_hdri.py` (360 panoramas) |

### Optional: Flash Attention

Not required -- all inference paths fall back to PyTorch SDPA. Install it only if
you want the speedup, and note that it compiles CUDA kernels from source (needs
`nvcc`, takes tens of minutes):

```bash
pip install psutil ninja packaging wheel   # flash_attn's setup.py needs these
pip install flash_attn --no-build-isolation
```


## πŸŽ₯ Inference

Our paper results were produced with the default `--num_inference_steps 50`. In
practice we found that 10 steps gives comparable quality on many cases, so the
video demo commands below pass `--num_inference_steps 10` to keep them fast.
Drop that flag to reproduce the paper setting.

### Video (MP4 or image folder)

```bash
# From MP4 file
python infer_video.py \
    --lora_path models/DiffHDR.safetensors \
    --input_path demo/room_window.mp4 \
    --output_dir results/video_mp4 \
    --prompt "" \
    --num_inference_steps 10 \
    --add_mask --use_under_exposure_mask --crop_and_resize --srgb_to_lg
```

#### Text-conditioned inference

Provide a descriptive prompt to guide HDR reconstruction:

```bash
python infer_video.py \
    --lora_path models/DiffHDR.safetensors \
    --input_path demo/wooden_house \
    --output_dir results/text_cond \
    --num_inference_steps 10 \
    --prompt "over-exposed: A bright ocean landscape visible through the skylight window, with a wide blue sea stretching to the horizon and soft clouds in the sky. Sunlight shines through the window and softly illuminates the wooden attic interior while keeping the indoor scene unchanged." \
    --seed 33 \
    --add_mask --crop_and_resize --srgb_to_lg
```

#### Image-conditioned inference

Provide a reference image to guide the style and tone of the HDR output:

```bash
python infer_video.py \
    --lora_path models/DiffHDR.safetensors \
    --input_path demo/wooden_house \
    --output_dir results/image_cond \
    --reference_image_path demo/ref_gemini_city.jpg \
    --prompt "" \
    --num_inference_steps 10 \
    --add_mask --crop_and_resize --srgb_to_lg
```

### Single Image

```bash
python infer_image.py \
    --lora_path models/DiffHDR.safetensors \
    --input_path demo/sample_image.png \
    --output_dir results/image_output \
    --prompt ""
```

### Long Video (sliding window)

For videos with more than 33 frames:

```bash
python infer_long_video.py \
    --lora_path models/DiffHDR.safetensors \
    --input_path demo/long_video_frames \
    --output_dir results/long_video_output \
    --prompt "" \
    --window_size 33 --window_stride 16 \
    --use_prev_window_reference \
    --add_mask --crop_and_resize --srgb_to_lg
```

**How it works:**
- Processes the video in overlapping windows of `window_size` frames
- Stride of `window_stride` frames between windows (overlap = window_size - window_stride)
- Linear temporal blending in overlap regions for smooth transitions
- `--use_prev_window_reference`: passes a reference frame from the previous window for temporal consistency

### HDRI Panorama

For single LDR panorama images (We extend this work to [HDRI](https://eyeline-labs.github.io/HDRI/)):

```bash
python infer_hdri.py \
    --lora_path models/DiffHDR_Pano.safetensors \
    --input_path demo/sample_pano.png \
    --output_dir results/hdri_output
```

This uses overexposure mask detection (luma + channel clipping) and outputs a single HDR EXR panorama at 1024x2048 by default.

## πŸ“Š Eval
Evaluate generated HDR EXR frames using `eval/cal_sample.py`:

```bash
# NR metrics only (MUSIQ, CLIPIQA, PU21-PIQE):
python eval/cal_sample.py \
    --gen_dir results/video_mp4 \
    --out_csv results/video_mp4_eval.csv

# With ground truth (adds FovVideoVDP):
python eval/cal_sample.py \
    --gen_dir results/video_mp4 \
    --gt_dir /path/to/gt_exr_frames \
    --out_csv results/video_mp4_eval.csv

# With DOVER video quality metric:
python eval/cal_sample.py \
    --gen_dir results/video_mp4 \
    --out_csv results/video_mp4_eval.csv \
    --dover_repo /path/to/DOVER
```

| Metric | Type | Description |
|--------|------|-------------|
| MUSIQ | NR | No-reference image quality (tonemapped) |
| CLIPIQA | NR | CLIP-based image quality (tonemapped) |
| PU21-PIQE | NR | Perceptual quality on PU21-encoded HDR luminance |
| FovVideoVDP | FR | Full-reference HDR visual difference (JOD) |
| DOVER | NR | No-reference video quality (tonemapped MP4) |
| FID | FR | Distribution distance on tonemapped patches |

For HDR-VDP-3, we follow LEDiff to use the Matlab scripts, please refer the `run_hdrvdp3_dir.m` for the configuration details.


## πŸ‹οΈ Training

```bash
# Launch LoRA training
bash scripts/train.sh
```

The training script uses HuggingFace Accelerate for distributed training.

**Training data format:** EXR frames organized by the metadata CSV, with sRGB LDR and linear HDR pairs.

## πŸ“š Citation

```bibtex
@article{yu2026diffhdr,
  title={DiffHDR: Re-Exposing LDR Videos with Video Diffusion Models},
  author={Yu, Zhengming and Ma, Li and He, Mingming and Isikdogan, Leo and Xu, Yuancheng and Smirnov, Dmitriy and Salamanca, Pablo and Mi, Dao and Delgado, Pablo and Yu, Ning and others},
  journal={arXiv preprint arXiv:2604.06161},
  year={2026}
}
```


## πŸ™ Acknowledgements
Our work is built upon many awesome prior works:

- **[DiffSynth-Studio](https://github.com/modelscope/DiffSynth-Studio)** --
  the `diffsynth/` package in this repository is a reduced, modified fork of it.
- **[Wan2.1-VACE-14B](https://huggingface.co/Wan-AI/Wan2.1-VACE-14B)** --
  the base video diffusion model that our LoRA is trained on top of.
  
We thank these authors for their great works and open-source contribution.




## πŸ“„ License

This project is released under the licence in [LICENSE](LICENSE).

It bundles third-party code: `diffsynth/` is derived from
[DiffSynth-Studio](https://github.com/modelscope/DiffSynth-Studio), licensed under
Apache-2.0. Files in that directory have been modified from the originals. The
upstream copyright and licence terms continue to apply to them.