NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Training Neural Networks on RAW and HDR Images for Restoration Tasks

Andrew Yanzhe Ke, Lei Luo, Xiaoyu Xiang, Yuchen Fan, Rakesh Ranjan, Alexandre Chapiro, Rafał K. MantiukarXiv 2023

TL;DR

Training neural networks for RAW and HDR image restoration in linear color spaces—the current "default" for many researchers—is surprisingly suboptimal. By simply switching the input representation to a perceptually uniform space (like PQ or PU21), models achieve massive performance gains of 2 to 9 dB across denoising, deblurring, and super-resolution tasks.

What Problem Does This Paper Address?

Most standard images (SDR) are stored in display-encoded spaces like sRGB, which are designed to be "perceptually uniform"—meaning a small change in pixel value corresponds to a roughly equal change in how we perceive brightness. In contrast, camera RAW and High Dynamic Range (HDR) images are typically represented in linear color spaces, where values are directly proportional to physical light intensity.

This creates a dilemma for deep learning:

  1. The Physics Argument: Physical phenomena like lens blur, motion blur, and sensor noise are linear. Therefore, restoration tasks (the inverse of these phenomena) should theoretically be modeled in linear space.
  2. The Perception Argument: Human vision is non-linear; we are far more sensitive to changes in dark areas than in bright ones. Linear spaces "waste" numerical precision on bright highlights that we can barely distinguish, while starving the shadows where we see every detail.

The authors set out to settle the debate: should we train networks on linear data, or should we encode them first?

Methods

The researchers conducted a comprehensive benchmark, testing eight combinations of pixel encodings and loss functions (summarized in Figure 6) across three major restoration tasks: single-image super-resolution (SISR), deblurring, and denoising.

Table 1. The eight combinations of pixel encoding and loss func- tions tested in our experiments.

They compared four main representations:

  • Linear: The raw, physical light values.
  • $\mu$-law: A logarithmic-like mapping often used in audio.
  • PQ (Perceptual Quantizer): The standard for HDR video (BT.2100).
  • PU21: A modern, numerically efficient perceptually uniform transform.

As shown in Figure 1, these encoding functions compress the massive dynamic range of light into a 0–1 range that is much better suited for neural network training.

Figure 1. Perceptual encoding functions used to transform linear RGB color values to an approximately perceptually uniform space. A logarithmic scale is used for the x-axis to account for Weber’s law. Following BT.2100, the range of interest for encoded values is between 0.005 and 10 000. Note, however, that in our experi- ments, we used a smaller range between 0 and 4 000. Since µ-law encoding expects input values between 0 and 1, the values were divided by 10 000 before passing to the function in Eq. (1).

Crucially, they also tested whether simply using a perceptual loss function (like SMAPE or an L1 loss calculated in a perceptual space) while keeping the input linear was enough to bridge the gap.

Datasets

  • HDR Dataset: A mix of 106 high-quality images from the HDR Photographic Survey and representative frames from the SJTU HDR Video Sequences.
  • RAW Dataset: 231 long-exposure images from the "Learning to See in the Dark" (LTSID) dataset. These were demosaiced to RGB but kept in their original linear sensor space for testing.

Key Insights and Ideas

  • Perceptual Encoding is a "One-Liner" Superpower: The most significant finding is that training on display-encoded (perceptually uniform) images consistently and significantly outperforms training on linear images. This is a simple change that requires no architectural modifications.
  • Input Representation Trumps Loss Function: Interestingly, just changing the loss function to be perceptually aware while keeping the input data linear (e.g., "Linear-PQ" in their tests) was not as effective as encoding the input itself. The network needs to "see" the data in a perceptually scaled way to learn efficiently.
  • Data Efficiency: The authors hypothesize that perceptual transforms act as a form of "data compression" for the network. By representing visually relevant information more efficiently, the network can devote more of its capacity to the actual restoration task rather than learning to compensate for the extreme non-uniformity of linear light.
  • Physics vs. Perception: Even though blur and noise are linear, the benefit of matching the network's "attention" to human perception far outweighs the theoretical benefit of maintaining physical linearity.

Key Results

The quantitative improvements were dramatic across the board. Using perceptual encodings (PQ, PU21, or $\mu$-law) resulted in:

  • Super-resolution: Gains of 1.5 to 9 dB in PSNR compared to the standard linear-L1 approach. As seen in Figure 3, the perceptual models (left side of the plots) consistently outperformed linear ones.
  • Deblurring: An improvement of approximately 3.8 dB. Notably, some models (like GFNNet) failed to even converge when trained on certain linear loss functions but worked perfectly with perceptual encodings.
  • Denoising: Perceptual encodings produced the best results, with $\mu$-law and PU21 being particularly robust.
Figure 3. Single-image super-resolution results for the HDR (top) and RAW (bottom) datasets, the two networks (Real-ESRGAN and EDSR), and three metrics. The violin shape represents the distribution across the testing set. A thin black line shows the range of quality scores (excluding outliers), and the thicker line shows the region between the 25th and 75th percentiles. The dot and numerical value represent the median. Red horizontal lines above the violin plots denote the groups of conditions for which we have no evidence of statistically significant differences. Results are sorted from the best on the left to the worst on the right. The colors are different for each combination of representation and loss and are consistent across plots.

Qualitatively, networks trained on linear data often produced visible color artifacts and softer details, whereas those trained on perceptual representations produced sharper, cleaner images.

Limitations and Future Work

While the results are clear, the authors acknowledge they don't have a "conclusive answer" as to why these transforms help so much, though data efficiency is the leading theory.

The study focused strictly on restoration tasks. It remains to be seen if these findings generalize to high-level vision tasks like object detection or segmentation on HDR/RAW data. Additionally, while PQ and PU21 are psychophysically grounded, they are more computationally expensive than the simpler $\mu$-law, which performed admirably well across most tests. Future work could explore even more efficient "one-liner" transforms tailored specifically for deep learning.

Summary updated

BibTeX
@misc{ke2023training,
  author = {Andrew Yanzhe Ke and Lei Luo and Xiaoyu Xiang and Yuchen Fan and Rakesh Ranjan and Alexandre Chapiro and Rafał K. Mantiuk},
  title = {{Training Neural Networks on RAW and HDR Images for Restoration Tasks}},
  year = {2023},
  eprint = {2312.03640},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2312.03640},
}
Figure