ZhengmingYu commited on
Commit
8c69cf0
Β·
verified Β·
1 Parent(s): 2d48846

Sync model card with GitHub README

Browse files
Files changed (1) hide show
  1. README.md +167 -92
README.md CHANGED
@@ -22,11 +22,11 @@ tags:
22
 
23
  [![Project Page](https://img.shields.io/badge/Project-Page-yellow?logo=googlechrome&logoColor=yellow)](https://eyeline-labs.github.io/DiffHDR/)
24
  [![Paper](https://img.shields.io/badge/Paper-arXiv-b31b1b?logo=arxiv&logoColor=red)](https://arxiv.org/abs/2604.06161)
25
- [![Code](https://img.shields.io/badge/Code-GitHub-black?logo=github)](https://github.com/Eyeline-Labs/DiffHDR)
26
  [![Demo Video](https://img.shields.io/badge/Demo-Video-red?logo=youtube&logoColor=white)](https://youtu.be/kq8qZfwBRs0)
27
 
28
  [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/>
29
- <sup>1</sup>Texas A&amp;M University, <sup>2</sup>Eyeline Labs, <sup>3</sup>Netflix
30
 
31
  <p align="center">
32
  <img src="./assets/teaser.png" alt="DiffHDR teaser figure">
@@ -34,64 +34,84 @@ tags:
34
 
35
  ## πŸ“ Abstract
36
 
37
- > 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 the over- and underexposed regions. To address this, we present **DiffHDR**, a framework that formulates LDR-to-HDR conversion as a generative radiance inpainting task within 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 of the quantized pixels. 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.
38
 
39
- ## πŸ”¬ Model overview
40
-
41
- DiffHDR uses a proposed **Log-Gamma Color Mapping** to compress linear HDR
42
- radiance into a bounded representation aligned with natural LDR statistics.
43
- This allows the pretrained LDR video VAE to encode and decode HDR content
44
- without VAE finetuning or shifting its learned latent space. A LoRA-adapted
45
- [Wan2.1-VACE-14B](https://huggingface.co/Wan-AI/Wan2.1-VACE-14B) backbone then
46
- performs generative radiance inpainting conditioned on the input LDR content
47
- and exposure masks, with optional text or reference-image control. The decoded
48
- result is inverse Log-Gamma mapped to linear HDR radiance.
49
-
50
- ## πŸ“¦ Model files
51
-
52
- This repository contains LoRA adapters, not a standalone model. Download the
53
- base model separately before running inference.
54
-
55
- | File | Intended inference entry points |
56
- | --- | --- |
57
- | `DiffHDR.safetensors` | `infer_video.py`, `infer_image.py`, and `infer_long_video.py` |
58
- | `DiffHDR_Pano.safetensors` | `infer_hdri.py` for 360-degree HDR panoramas |
59
 
60
  ## πŸ› οΈ Setup
61
 
62
- Clone and install the inference code:
63
-
64
  ```bash
65
- git clone https://github.com/Eyeline-Labs/DiffHDR.git
66
- cd DiffHDR
67
-
68
  conda create -n diffhdr python=3.10 -y
69
  conda activate diffhdr
70
 
 
71
  pip install torch==2.6.0 torchvision==0.21.0 torchaudio==2.6.0 \
72
  --index-url https://download.pytorch.org/whl/cu118
 
 
 
73
  pip install -e .
74
  pip install -r requirements.txt
75
  ```
76
 
77
- Download the base model and the DiffHDR adapters:
 
 
 
78
 
79
  ```bash
80
- hf download Wan-AI/Wan2.1-VACE-14B \
81
- --local-dir models/Wan-AI/Wan2.1-VACE-14B
82
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
  hf download ZhengmingYu/DiffHDR --local-dir models
84
  ```
85
 
86
- The Wan2.1-VACE-14B download is approximately 75 GB and is not included in this
87
- repository. Set `MODEL_BASE` if you store the base model somewhere other than
88
- `models/`.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
 
90
  ## πŸŽ₯ Inference
91
 
92
- Minimal video example:
 
 
 
 
 
93
 
94
  ```bash
 
95
  python infer_video.py \
96
  --lora_path models/DiffHDR.safetensors \
97
  --input_path demo/room_window.mp4 \
@@ -101,17 +121,51 @@ python infer_video.py \
101
  --add_mask --use_under_exposure_mask --crop_and_resize --srgb_to_lg
102
  ```
103
 
104
- Additional entry points:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
 
106
  ```bash
107
- # Single image
108
  python infer_image.py \
109
  --lora_path models/DiffHDR.safetensors \
110
  --input_path demo/sample_image.png \
111
  --output_dir results/image_output \
112
  --prompt ""
 
 
 
113
 
114
- # Long video using overlapping temporal windows
 
 
115
  python infer_long_video.py \
116
  --lora_path models/DiffHDR.safetensors \
117
  --input_path demo/long_video_frames \
@@ -120,66 +174,71 @@ python infer_long_video.py \
120
  --window_size 33 --window_stride 16 \
121
  --use_prev_window_reference \
122
  --add_mask --crop_and_resize --srgb_to_lg
 
 
 
 
 
 
 
 
 
123
 
124
- # 360-degree LDR panorama to HDR panorama
 
 
125
  python infer_hdri.py \
126
  --lora_path models/DiffHDR_Pano.safetensors \
127
  --input_path demo/sample_pano.png \
128
  --output_dir results/hdri_output
129
  ```
130
 
131
- The inference scripts write linear HDR OpenEXR output. Video inference writes
132
- one EXR file per frame; panorama inference writes `predicted.exr`. See the
133
- [code repository README](https://github.com/Eyeline-Labs/DiffHDR#inference) for
134
- text conditioning, reference-image conditioning, arguments, and additional
135
- examples.
136
-
137
- ## 🎯 Intended use
138
-
139
- DiffHDR is intended for research and creative LDR-to-HDR reconstruction,
140
- including:
141
-
142
- - reconstructing HDR video or still images from LDR input;
143
- - recovering plausible highlight and shadow content for display and
144
- post-production workflows;
145
- - text- or reference-image-guided HDR reconstruction; and
146
- - reconstructing HDR environment panoramas.
147
-
148
- ## ⚠️ Limitations and responsible use
149
-
150
- - Detail in clipped or quantized regions is generated by the model. It is a
151
- plausible reconstruction and is not guaranteed to reproduce the original
152
- scene radiance.
153
- - Outputs may contain hallucinated detail, temporal inconsistency, color
154
- shifts, or exposure artifacts, especially on inputs outside the training
155
- distribution.
156
- - Results can vary with prompts, reference images, random seeds, and inference
157
- settings.
158
- - The model inherits limitations and potential biases from its base model and
159
- training data.
160
- - Do not use generated output as a calibrated radiometric measurement, as
161
- forensic evidence, or in safety-critical decisions.
162
- - Users are responsible for ensuring that their input media and intended use
163
- comply with applicable rights, licenses, and laws.
164
-
165
- ## πŸ‹οΈ Training and evaluation
166
-
167
- DiffHDR is trained as a LoRA adapter on top of Wan2.1-VACE-14B while keeping
168
- the video VAE frozen. Its synthetic training set is rendered from approximately
169
- 800 high-resolution HDRIs and contains about 5,400 temporally consistent
170
- 81-frame HDR sequences. Exposure shifts, temporally correlated camera noise,
171
- clipping, and 8-bit quantization are simulated to produce paired LDR inputs.
172
- Method details, experimental settings, and comparisons are reported in the
173
- [paper](https://arxiv.org/abs/2604.06161).
174
 
175
- ## πŸ“„ License
 
176
 
177
- The DiffHDR LoRA adapter weights in this repository are released under the
178
- [Apache License 2.0](LICENSE).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
179
 
180
- The Wan2.1-VACE-14B base weights are distributed separately and remain subject
181
- to their own license and model-card guidance. This license does not grant rights
182
- to third-party code, datasets, or user-supplied input content.
183
 
184
  ## πŸ“š Citation
185
 
@@ -192,9 +251,25 @@ to third-party code, datasets, or user-supplied input content.
192
  }
193
  ```
194
 
 
195
  ## πŸ™ Acknowledgements
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
196
 
197
- DiffHDR builds on
198
- [Wan2.1-VACE-14B](https://huggingface.co/Wan-AI/Wan2.1-VACE-14B) and
199
- [DiffSynth-Studio](https://github.com/modelscope/DiffSynth-Studio). Please also
200
- credit and follow the license terms of these upstream projects.
 
22
 
23
  [![Project Page](https://img.shields.io/badge/Project-Page-yellow?logo=googlechrome&logoColor=yellow)](https://eyeline-labs.github.io/DiffHDR/)
24
  [![Paper](https://img.shields.io/badge/Paper-arXiv-b31b1b?logo=arxiv&logoColor=red)](https://arxiv.org/abs/2604.06161)
25
+ [![Hugging Face](https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-DiffHDR-blue)](https://huggingface.co/ZhengmingYu/DiffHDR)
26
  [![Demo Video](https://img.shields.io/badge/Demo-Video-red?logo=youtube&logoColor=white)](https://youtu.be/kq8qZfwBRs0)
27
 
28
  [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/>
29
+ <sup>1</sup>Texas A&amp;M University, <sup>2</sup>Eyeline Labs, <sup>3</sup>Netflix<br/>
30
 
31
  <p align="center">
32
  <img src="./assets/teaser.png" alt="DiffHDR teaser figure">
 
34
 
35
  ## πŸ“ Abstract
36
 
37
+ > 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.
38
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
 
40
  ## πŸ› οΈ Setup
41
 
 
 
42
  ```bash
 
 
 
43
  conda create -n diffhdr python=3.10 -y
44
  conda activate diffhdr
45
 
46
+ # Install PyTorch (CUDA 11.8)
47
  pip install torch==2.6.0 torchvision==0.21.0 torchaudio==2.6.0 \
48
  --index-url https://download.pytorch.org/whl/cu118
49
+
50
+ # Install DiffHDR
51
+ cd /path/to/DiffHDR_Code
52
  pip install -e .
53
  pip install -r requirements.txt
54
  ```
55
 
56
+ ### Base model
57
+
58
+ Download Wan2.1-VACE-14B (~75 GB). This single repo contains everything needed --
59
+ the 7 DiT shards, the T5 text encoder, the VAE, and the umt5-xxl tokenizer:
60
 
61
  ```bash
62
+ hf download Wan-AI/Wan2.1-VACE-14B --local-dir models/Wan-AI/Wan2.1-VACE-14B
63
+ ```
64
 
65
+ Expected layout:
66
+
67
+ ```
68
+ models/Wan-AI/Wan2.1-VACE-14B/
69
+ β”œβ”€β”€ diffusion_pytorch_model-0000{1..7}-of-00007.safetensors
70
+ β”œβ”€β”€ models_t5_umt5-xxl-enc-bf16.pth
71
+ β”œβ”€β”€ Wan2.1_VAE.pth
72
+ └── google/umt5-xxl/
73
+ ```
74
+
75
+ Set the `MODEL_BASE` environment variable to point the scripts at a different
76
+ root instead of `models/`.
77
+
78
+ ### LoRA checkpoints
79
+
80
+ ```bash
81
+ mkdir -p models
82
  hf download ZhengmingYu/DiffHDR --local-dir models
83
  ```
84
 
85
+ This fetches both LoRA weights (58 MB each) into `models/`:
86
+
87
+ | File | Use with |
88
+ |------|----------|
89
+ | `DiffHDR.safetensors` | `infer_video.py`, `infer_image.py`, `infer_long_video.py` |
90
+ | `DiffHDR_Pano.safetensors` | `infer_hdri.py` (360 panoramas) |
91
+
92
+ ### Optional: Flash Attention
93
+
94
+ Not required -- all inference paths fall back to PyTorch SDPA. Install it only if
95
+ you want the speedup, and note that it compiles CUDA kernels from source (needs
96
+ `nvcc`, takes tens of minutes):
97
+
98
+ ```bash
99
+ pip install psutil ninja packaging wheel # flash_attn's setup.py needs these
100
+ pip install flash_attn --no-build-isolation
101
+ ```
102
+
103
 
104
  ## πŸŽ₯ Inference
105
 
106
+ Our paper results were produced with the default `--num_inference_steps 50`. In
107
+ practice we found that 10 steps gives comparable quality on many cases, so the
108
+ video demo commands below pass `--num_inference_steps 10` to keep them fast.
109
+ Drop that flag to reproduce the paper setting.
110
+
111
+ ### Video (MP4 or image folder)
112
 
113
  ```bash
114
+ # From MP4 file
115
  python infer_video.py \
116
  --lora_path models/DiffHDR.safetensors \
117
  --input_path demo/room_window.mp4 \
 
121
  --add_mask --use_under_exposure_mask --crop_and_resize --srgb_to_lg
122
  ```
123
 
124
+ #### Text-conditioned inference
125
+
126
+ Provide a descriptive prompt to guide HDR reconstruction:
127
+
128
+ ```bash
129
+ python infer_video.py \
130
+ --lora_path models/DiffHDR.safetensors \
131
+ --input_path demo/wooden_house \
132
+ --output_dir results/text_cond \
133
+ --num_inference_steps 10 \
134
+ --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." \
135
+ --seed 33 \
136
+ --add_mask --crop_and_resize --srgb_to_lg
137
+ ```
138
+
139
+ #### Image-conditioned inference
140
+
141
+ Provide a reference image to guide the style and tone of the HDR output:
142
+
143
+ ```bash
144
+ python infer_video.py \
145
+ --lora_path models/DiffHDR.safetensors \
146
+ --input_path demo/wooden_house \
147
+ --output_dir results/image_cond \
148
+ --reference_image_path demo/ref_gemini_city.jpg \
149
+ --prompt "" \
150
+ --num_inference_steps 10 \
151
+ --add_mask --crop_and_resize --srgb_to_lg
152
+ ```
153
+
154
+ ### Single Image
155
 
156
  ```bash
 
157
  python infer_image.py \
158
  --lora_path models/DiffHDR.safetensors \
159
  --input_path demo/sample_image.png \
160
  --output_dir results/image_output \
161
  --prompt ""
162
+ ```
163
+
164
+ ### Long Video (sliding window)
165
 
166
+ For videos with more than 33 frames:
167
+
168
+ ```bash
169
  python infer_long_video.py \
170
  --lora_path models/DiffHDR.safetensors \
171
  --input_path demo/long_video_frames \
 
174
  --window_size 33 --window_stride 16 \
175
  --use_prev_window_reference \
176
  --add_mask --crop_and_resize --srgb_to_lg
177
+ ```
178
+
179
+ **How it works:**
180
+ - Processes the video in overlapping windows of `window_size` frames
181
+ - Stride of `window_stride` frames between windows (overlap = window_size - window_stride)
182
+ - Linear temporal blending in overlap regions for smooth transitions
183
+ - `--use_prev_window_reference`: passes a reference frame from the previous window for temporal consistency
184
+
185
+ ### HDRI Panorama
186
 
187
+ For single LDR panorama images (We extend this work to [HDRI](https://eyeline-labs.github.io/HDRI/)):
188
+
189
+ ```bash
190
  python infer_hdri.py \
191
  --lora_path models/DiffHDR_Pano.safetensors \
192
  --input_path demo/sample_pano.png \
193
  --output_dir results/hdri_output
194
  ```
195
 
196
+ This uses overexposure mask detection (luma + channel clipping) and outputs a single HDR EXR panorama at 1024x2048 by default.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
197
 
198
+ ## πŸ“Š Eval
199
+ Evaluate generated HDR EXR frames using `eval/cal_sample.py`:
200
 
201
+ ```bash
202
+ # NR metrics only (MUSIQ, CLIPIQA, PU21-PIQE):
203
+ python eval/cal_sample.py \
204
+ --gen_dir results/video_mp4 \
205
+ --out_csv results/video_mp4_eval.csv
206
+
207
+ # With ground truth (adds FovVideoVDP):
208
+ python eval/cal_sample.py \
209
+ --gen_dir results/video_mp4 \
210
+ --gt_dir /path/to/gt_exr_frames \
211
+ --out_csv results/video_mp4_eval.csv
212
+
213
+ # With DOVER video quality metric:
214
+ python eval/cal_sample.py \
215
+ --gen_dir results/video_mp4 \
216
+ --out_csv results/video_mp4_eval.csv \
217
+ --dover_repo /path/to/DOVER
218
+ ```
219
+
220
+ | Metric | Type | Description |
221
+ |--------|------|-------------|
222
+ | MUSIQ | NR | No-reference image quality (tonemapped) |
223
+ | CLIPIQA | NR | CLIP-based image quality (tonemapped) |
224
+ | PU21-PIQE | NR | Perceptual quality on PU21-encoded HDR luminance |
225
+ | FovVideoVDP | FR | Full-reference HDR visual difference (JOD) |
226
+ | DOVER | NR | No-reference video quality (tonemapped MP4) |
227
+ | FID | FR | Distribution distance on tonemapped patches |
228
+
229
+ For HDR-VDP-3, we follow LEDiff to use the Matlab scripts, please refer the `run_hdrvdp3_dir.m` for the configuration details.
230
+
231
+
232
+ ## πŸ‹οΈ Training
233
+
234
+ ```bash
235
+ # Launch LoRA training
236
+ bash scripts/train.sh
237
+ ```
238
+
239
+ The training script uses HuggingFace Accelerate for distributed training.
240
 
241
+ **Training data format:** EXR frames organized by the metadata CSV, with sRGB LDR and linear HDR pairs.
 
 
242
 
243
  ## πŸ“š Citation
244
 
 
251
  }
252
  ```
253
 
254
+
255
  ## πŸ™ Acknowledgements
256
+ Our work is built upon many awesome prior works:
257
+
258
+ - **[DiffSynth-Studio](https://github.com/modelscope/DiffSynth-Studio)** --
259
+ the `diffsynth/` package in this repository is a reduced, modified fork of it.
260
+ - **[Wan2.1-VACE-14B](https://huggingface.co/Wan-AI/Wan2.1-VACE-14B)** --
261
+ the base video diffusion model that our LoRA is trained on top of.
262
+
263
+ We thank these authors for their great works and open-source contribution.
264
+
265
+
266
+
267
+
268
+ ## πŸ“„ License
269
+
270
+ This project is released under the licence in [LICENSE](LICENSE).
271
 
272
+ It bundles third-party code: `diffsynth/` is derived from
273
+ [DiffSynth-Studio](https://github.com/modelscope/DiffSynth-Studio), licensed under
274
+ Apache-2.0. Files in that directory have been modified from the originals. The
275
+ upstream copyright and licence terms continue to apply to them.