DiffuseRAW: End-to-End Generative RAW Image Processing for Low-Light Images

Rishit DagliarXiv 2023

Abstract

Imaging under extremely low-light conditions presents a significant challenge and is an ill-posed problem due to the low signal-to-noise ratio (SNR) caused by minimal photon capture. Previously, diffusion models have been used for multiple kinds of generative tasks and image-to-image tasks; however, these models typically function as a post-processing step, trained on and learning from already processed images. Such approaches are often not well-suited for extreme low-light tasks where the initial signal is heavily degraded. Unlike traditional low-light image enhancement, we tackle the task of learning the entire image-processing pipeline, from the RAW image to a processed output. We develop a new generative Image Signal Processor (ISP) that relies on fine-tuning latent diffusion models (LDMs) on RAW images. This allows for the apt use of priors from large text-to-image generation models to reconstruct long-exposure images. Our approach achieves state-of-the-art (SoTA) results on the See-in-the-Dark (SID) dataset, paving the way for generative diffusion-based processing on RAW data.

Introduction

In the world of computational photography, low-light imaging is often considered the ultimate challenge. When shooting in near-total darkness (less than 0.1 lux), a camera sensor captures only a handful of photons. The resulting signal-to-noise ratio (SNR) is so low that the actual scene information is buried under a mountain of grain, thermal noise, and read noise.

Traditional approaches rely on an Image Signal Processor (ISP)—a sequence of specialized steps like demosaicing, denoising, and color correction. However, in extreme low light, this pipeline often breaks down. Traditional denoising tends to smear away fine details, while simple amplification (boosting ISO) merely magnifies the noise. DiffuseRAW proposes a radical shift: instead of fixing a broken image through traditional steps, it utilizes a generative model to learn the entire camera pipeline from scratch, transforming raw sensor data directly into high-quality, long-exposure equivalents.

The Generative ISP Framework

The core innovation of DiffuseRAW is the adaptation of a pre-trained Latent Diffusion Model (LDM)—specifically Stable Diffusion v1.5—to act as a "Generative ISP." By moving the enhancement process to the beginning of the pipeline, the model preserves the vast information present in RAW data before it is mangled by standard processing.

Methodology

  1. RAW Packing: The model bypasses standard JPEGs, instead ingesting Bayer RAW images. These are "packed" into four channels ($R, G_r, B, G_b$) at half the original resolution to maintain spatial relationships while reducing computational load.
  2. Preprocessing: The system subtracts the sensor's specific "black level," scales the brightness by a manual amplification factor, and upsamples the image back to full resolution using bicubic interpolation.
  3. Conditioning and Fine-Tuning: This processed RAW data serves as a conditioning signal for the diffusion model. The LDM is fine-tuned to "denoise" a random noise latent into a clean, long-exposure version of the scene.
  4. Generative Guidance: Using classifier-free diffusion guidance, the model balances the input RAW image with text prompts. This allows the model to leverage its massive "prior knowledge" of natural images—learned during its original training on millions of high-quality photos—to reconstruct textures and details that are physically missing or obscured in the noisy input.

Experimental Results

The researchers evaluated DiffuseRAW on two primary benchmarks: the See-in-the-Dark (SID) dataset (Sony $\alpha$7SII subset) and the Extreme Low-light Denoising (ELD) dataset.

Quantitative Performance

DiffuseRAW set a new State-of-the-Art (SoTA) on the SID dataset, particularly at extreme amplification levels (e.g., $\times300$). On the SID Sony subset, the model achieved a PSNR of 39.98 and an SSIM of 0.951. For comparison, previous high-performing models like LSID and PMN reached PSNRs of 36.85 and 37.77, respectively. This jump in performance highlights the efficacy of using generative priors to fill in the gaps where traditional convolutional neural networks (CNNs) might produce blurry or muddy results.

Qualitative Insights

Visual comparisons demonstrate that DiffuseRAW produces significantly sharper details and more accurate color reproduction in "impossible" lighting conditions. While traditional methods often suffer from color shifts or loss of high-frequency textures in deep shadows, DiffuseRAW maintains structural integrity and vibrant color by implicitly learning demosaicing and white balance during the diffusion process.

Discussion and Limitations

While DiffuseRAW represents a significant leap forward, several challenges remain for real-world deployment:

  • Computational Cost: Diffusion models are iterative and computationally expensive compared to single-pass CNNs, making real-time implementation on mobile hardware difficult.
  • Exposure Sensitivity: The current iteration requires a manually set amplification factor; future work is needed to integrate "auto-exposure" capabilities for general, unconstrained scenes.
  • Sensor Specificity: The model is currently fine-tuned for specific sensors. Developing a "Universal ISP" that generalizes across different smartphone and DSLR hardware remains an open research question.

Conclusion

DiffuseRAW demonstrates that generative models are not just for creating art from text; they are powerful tools for fundamental image processing. By treating the camera pipeline as a generative task, the authors have shown that it is possible to recover clear, usable images from data that was previously considered unusable noise. This work paves the way for a new generation of diffusion-based RAW processing techniques in computational photography.

Summary updated

BibTeX
@misc{dagli2023diffuseraw,
  author = {Rishit Dagli},
  title = {{DiffuseRAW: End-to-End Generative RAW Image Processing for Low-Light Images}},
  year = {2023},
  eprint = {2402.18575},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2402.18575},
}
Figure