TL;DR
Existing RAW image reconstruction methods focus strictly on pixel-level accuracy in the RAW domain, which often causes the reconstructed images to fall apart under post-capture editing. This paper introduces a plug-and-play, "edit-aware" loss function that uses a differentiable Image Signal Processor (ISP) during training to ensure reconstructed RAW images remain robust and artifact-free across diverse editing styles, boosting final sRGB rendering quality by up to 2 dB.
What Problem Does This Paper Address?
When you snap a photo on your smartphone, the camera's internal Image Signal Processor (ISP) converts the raw sensor data (RAW) into a compressed, display-ready image like an 8-bit sRGB JPEG. This conversion discards a massive amount of dynamic range and color data. While editing a RAW file offers far superior flexibility and quality, consumer devices rarely save them due to storage constraints.
To restore this lost flexibility, researchers have built Deep Neural Networks (DNNs) to reconstruct RAW data from standard sRGB images. However, conventional methods train these networks by minimizing pixel-wise differences directly in the RAW domain. The catch? A reconstructed RAW image that looks perfect on paper can develop severe banding, color shifts, and ugly artifacts the moment a user tries to adjust its exposure, white balance, or contrast in an editor like Adobe Photoshop. This paper addresses the gap between RAW reconstruction fidelity and downstream editability.
Methods
The authors propose an edit-aware loss function ($\mathcal{L}_{\text{sRGB}}$) that can be seamlessly integrated into any existing RAW reconstruction network.
Instead of only comparing the reconstructed RAW to the ground-truth RAW directly, the proposed framework passes both through a modular, tunable, non-learnable differentiable ISP during training. This synthetic ISP simulates four common camera processing stages:
- Exposure adjustment: Randomly scaling scene brightness.
- White balance: Sampling realistic illuminants from a pre-built chromaticity dictionary.
- Color manipulation: Utilizing Multi-Layer Perceptrons (MLPs) trained offline to mimic non-linear 3D Lookup Tables (LUTs).
- Tone mapping: Applying standard tone curves perturbed by random low-degree polynomials.
During training, the parameters for these modules are randomly sampled for every batch. The loss is then calculated as the mean squared error ($\ell_2$ loss) between the edited sRGB outputs of the ground-truth and reconstructed RAW images. This forces the network to prioritize features that matter for downstream editing. For metadata-assisted models, this loss also enables target edit-aware fine-tuning at inference time, optimizing the model weights specifically for a user's desired edit.
Datasets
- Smartphone RAW Dataset: Consists of 3,224 images captured with the main rear camera of a Samsung S24 Ultra. The dataset is split into 2,619 training, 205 validation, and 400 test images, providing pairs of denoised/demosaiced linear RAW images and camera-rendered sRGB JPEGs.
- NUS Dataset: Used for additional cross-dataset evaluation (discussed in the supplementary material).
Key Insights and Ideas
- RAW Fidelity $\neq$ Editability: Minimizing error solely in RAW space allows networks to "cheat" by overfitting to the specific inverse-ISP mapping of the training set, leaving the reconstructed RAW fragile to any subsequent distribution shifts caused by editing.
- Stochastic Regularization via ISP: Randomly perturbing the ISP parameters during training acts as a powerful regularizer. It forces the network to learn the underlying physical properties of the scene rather than just a brittle mathematical inversion.
- Test-Time Adaptation for Specific Edits: If a user knows they want a specific edit (e.g., +2 exposure, 3000K color temperature), the differentiable ISP parameters can be locked to those exact values during test-time fine-tuning, yielding even cleaner results.
Key Results
The edit-aware loss was evaluated across three distinct architectures: CAM (metadata-assisted), RAW Diffusion (blind), and a standard UNet.
- Quantitative Gains: Across five distinct Photoshop editing presets, adding the edit-aware loss consistently improved sRGB rendering quality, showing boosts of 1.5 to 2 dB PSNR under heavy edits.
- Qualitative Improvements: Reconstructions using the new loss successfully eliminated severe banding and global color distortions common in baseline models.
- User Preference: In a blind perceptual study with 25 users across 20 images, the proposed method was preferred 83% of the time over standard reconstructions.
Limitations and Future Work
- Training Overhead: Incorporating the differentiable ISP increases training time by approximately 15% due to the stochastic sampling steps (though inference speed remains completely unaffected).
- Extreme Conditions: The model struggles with extreme low-light scenes or highly unusual lighting environments (like vibrant green LEDs) that fall outside the training distribution.
- Local Edits: The current differentiable ISP only models global adjustments (global tone curves and 3D LUTs) and does not explicitly account for localized tone mapping or spatial editing masks.
Summary updated