Research
Edit-aware RAW Reconstruction
Overview Research area: Computational photography and image restoration — specifically RAW image reconstruction from rendered sRGB images, with emphasis on downstream photo editing. Technical level: I
- arXiv
- 2512.05859
- Published
- 2025-12-05
- Authors
- Abhijith Punnappurath, Luxi Zhao, Ke Zhao, Hue Nguyen, Radek Grzeszczuk, Michael S. Brown
AI summary
Overview
Research area: Computational photography and image restoration — specifically RAW image reconstruction from rendered sRGB images, with emphasis on downstream photo editing.
Technical level: Intermediate. The core idea is intuitive, but the paper assumes familiarity with camera image signal processor (ISP) stages such as white balance, color space transforms, tone curves, and 3D lookup tables.
Scope: The paper introduces a plug-and-play, edit-aware loss function built on a differentiable, tunable ISP that can be added to existing RAW reconstruction models to make recovered RAW images more robust to rendering style changes and post-capture edits.
What This Paper Is About
Most photos people edit are 8-bit sRGB JPEGs produced by the camera's on-board ISP, because RAW files are rarely kept. Editing in the RAW domain would give more accuracy and flexibility, so researchers have built methods that reconstruct RAW data from an sRGB image. However, existing RAW reconstruction methods are trained to match RAW pixels as closely as possible, and they degrade when the reconstructed RAW is later re-rendered or edited with a different photo-finishing style. This paper's goal is a training loss that directly optimizes reconstructed RAWs for editing and rendering quality in sRGB space, rather than for pixel-level RAW fidelity alone.
Key Contributions
-
A plug-and-play edit-aware loss function that can be integrated into any existing RAW reconstruction framework without architectural changes. It is computed in sRGB space between ground-truth and reconstructed RAWs, both rendered through the same differentiable ISP.
-
A modular, differentiable, tunable ISP that models four stages — exposure, white balance, color manipulation, and tone mapping — with parameters randomly sampled during training from distributions designed to reflect realistic camera processing. The method does not require access to the actual (proprietary) camera ISP.
-
Demonstrated generality across model classes. The loss is evaluated on three representative models: CAM (metadata-assisted), RAW Diffusion (blind), and a UNet-based metadata-assisted model, with consistent improvements in sRGB rendering quality across edits.
-
Target-edit-aware fine-tuning. For metadata-assisted methods, the loss enables fine-tuning not only to a specific image but also to a specific target edit, giving further gains over standard image-only fine-tuning.
Main Findings
-
sRGB gains across edits: Incorporating the edit-aware loss improves sRGB reconstruction quality by up to 1.5–2 dB PSNR across various editing conditions. For CAM, sRGB PSNR under the five Photoshop edits improved from 27.27 to 29.24 (Edit 1), 26.95 to 28.97 (Edit 2), 28.91 to 30.72 (Edit 3), 27.70 to 29.23 (Edit 4), and 25.43 to 27.43 (Edit 5). The largest gains — up to 2 dB — were observed under more substantial edits such as Edit 5.
-
Blind model improvement: RAW Diffusion improved from 24.27 to 25.44 (Edit 1), 23.96 to 25.46 (Edit 2), 26.09 to 27.17 (Edit 3), 25.33 to 25.66 (Edit 4), and 23.29 to 25.03 (Edit 5). The paper notes its RAW PSNR dropped from 34.18 to 33.37, trading a small amount of RAW fidelity for better sRGB results.
-
UNet with only the sRGB loss: The UNet was trained using only the edit-aware sRGB loss, omitting the RAW loss entirely. RAW PSNR dropped from 38.82 to 35.62, but edited sRGB results improved (e.g., Edit 5 from 26.44 to 28.02 PSNR, ΔE from 6.88 to 5.75).
-
Target-edit-aware fine-tuning helps further: On the UNet, fine-tuning with φ randomly sampled gave 31.31 / 31.11 / 31.09 PSNR for EV +2, CCT 3000K, and both combined, versus 30.26 / 30.84 / 30.12 for the baseline fine-tuned to the image. Fixing φ to the target edit raised these to 31.51 / 31.20 / 31.26.
-
All ISP modules and sampling matter: On a subset of 50 challenging images for Edit 5, sRGB PSNR was 23.22 with exposure only, 22.35 with white balance only, 20.54 with color only, 23.77 with tone only, 24.20 with a fixed (non-sampled) pipeline, and 25.15 with the full sampled configuration. The paper notes the fixed-pipeline row is equivalent to the cyclic consistency loss used by forward-inverse methods.
-
User study preference: In a blind forced-choice study of 20 images from the 50-image challenging set with 25 users and 1500 responses, the method was preferred 83% of the time; preferences were 77% for CAM, 88% for RAW Diffusion, and 82% for UNet.
-
Generalizes to image-specific edits: With manual image-specific edits on the 50-image challenging set, CAM improved from 22.11 to 24.36 PSNR, RAW Diffusion from 20.57 to 21.59, and UNet from 23.30 to 24.58.
-
Training cost, not inference cost: Adding the loss increased training time by approximately 15% in the authors' experiments, while inference remained unchanged.
-
Failure modes: The method performs best for strong edits inducing large tonal, color, or contrast changes. Observed failures occurred primarily in extreme low-light scenes or uncommon lighting (e.g., green LEDs) not seen during training.
Methodology in Plain English
The researchers start from the standard training setup used by RAW reconstruction models: given an sRGB image y, a network f<sub>θ</sub> predicts a RAW image x̂, and training minimizes the ℓ2 error between x̂ and the true RAW x. To that, they add a second loss computed after pushing both x and x̂ through a simplified simulated camera pipeline. Because both images go through the same simulated pipeline with the same randomly chosen settings, the loss measures whether the reconstructed RAW will render to the same sRGB image as the true RAW when a user applies a given edit.
The simulated pipeline has four stages, modeled after real camera processing:
- Exposure: multiply the RAW by 2 raised to a random exposure value, drawn from a normal distribution (σ = 0.75).
- White balance and color space transform: sample an illuminant from a 2D multivariate Gaussian fitted to AsShotNeutral chromaticity values [r/g, b/g] extracted from DNG metadata across many images (M = 2,619, corresponding to all training images). The sampled illuminant is constrained to the convex hull of that set and to a Euclidean distance threshold relative to the image's own AsShotNeutral value, since users typically make only small white-balance adjustments. The image is multiplied by a diagonal matrix derived from the illuminant, then transformed to CIE XYZ with a color space transform matrix interpolated between two factory-calibrated DNG color matrices.
- Color manipulation: real ISPs use 3D lookup tables, which are not differentiable, so the authors train MLPs to approximate 15 (K = 15) selected 3D LUTs. These MLPs are trained offline and frozen; one LUT is chosen at random per mini-batch.
- Tone mapping: an MLP approximates the Adobe tone curve, and random monotonically non-decreasing low-degree polynomials (degree up to d = 5) are applied to perturb it. A fixed matrix maps to linear sRGB, followed by a gamma of 1/2.2.
The final loss combines the original RAW loss, any auxiliary losses the base method already used, and the new sRGB loss weighted by a scalar λ (λ = 2 for CAM, λ = 4 for RAW Diffusion).
Experiments use a smartphone RAW dataset of 3,224 images captured with the main rear camera of a Samsung S24 Ultra at 4000 × 3000 pixels, split into 2,619 training, 205 validation, and 400 test images. For evaluation, reconstructed RAWs are saved as DNG files and edited in Adobe Photoshop's Camera RAW plugin using five fixed edits, including presets, exposure changes, curve adjustments, and a temperature setting of 3500 K. The authors deliberately use Photoshop — a complex, full-featured software ISP independent of their training pipeline — to show the loss transfers to unknown processing.
Why This Matters
Impact on research: The paper reframes RAW reconstruction as a problem whose objective should match its end use — photographic editing — rather than pixel-level RAW fidelity. It provides a general training-time mechanism that any reconstruction method can adopt, and its ablation shows that a fixed, non-sampled pipeline (equivalent to existing cyclic consistency losses) performs worse than randomized sampling. This suggests prior sRGB-domain supervision was too narrow.
Real-world applications:
- Smartphone photo galleries: Enabling RAW-level editing quality for users who only have the camera's JPEG, without storing large RAW files.
- Cloud or metadata-assisted RAW recovery: Consumer devices could store small amounts of capture-time metadata (the UNet experiment used an 8× downsampled RAW, approximately 1.5% metadata overhead) and reconstruct an editable RAW later.
- Photo editing software: Tools like Photoshop or Camera RAW could benefit from reconstructions that better match ground truth under presets such as "Cool matte," "Warm contrast," or "Flat and green."
- Capture-to-edit workflows: Since inference cost is unchanged, existing deployed reconstruction models could be retrained with the new loss and gain editability without deployment changes.
Industry relevance: The work comes from the AI Center–Toronto at Samsung Electronics, and it targets the practical consumer-imaging scenario where users edit JPEGs in galleries. Its emphasis on not needing access to proprietary camera ISPs makes it applicable to third-party software that must work with unknown camera pipelines.
Future Directions
-
Handling extreme and uncommon lighting: The authors report that failures occurred in extreme low-light scenes and uncommon lighting such as green LEDs not seen during training. Expanding the sampling distributions or the illuminant dictionary could address this.
-
Restricting sampling to known target edits: The paper notes that if specific target edit conditions are known a priori, sampling can be restricted so the model trains for those specific edits while still using the edit-aware paradigm. This is posed as a flexibility, and exploring it systematically is a natural next step.
-
Extending beyond the modeled ISP stages: The pipeline does not explicitly model local tone mapping, and the authors note that random per-patch tone sampling may offer only a degree of robustness to local tonal adjustments. Explicitly modeling local operations is left open.
-
Applying target-edit-aware fine-tuning more broadly: Fine-tuning was demonstrated on the UNet in the main paper and on CAM in the supplementary material, using exposure and white balance as representative edits. Extending this to other edit types and to blind methods (which lack stored metadata for fine-tuning) is an open question.
Target Audience
Researchers and engineers working on RAW image reconstruction, computational photography, and learned ISP modeling will find the method directly applicable, since the loss is designed to plug into existing frameworks. Practitioners building mobile camera pipelines or photo-editing software will benefit from the practical framing around edit fidelity, metadata overhead, and the fact that inference cost is unchanged. Students with some background in image processing will also find the modular ISP design a useful, readable template, though the paper assumes comfort with the standard RAW-to-sRGB processing chain.
Authors’ abstract
Users frequently edit camera images post-capture to achieve their preferred photofinishing style. While editing in the RAW domain provides greater accuracy and flexibility, most edits are performed on the camera's display-referred output (e.g., 8-bit sRGB JPEG) since RAW images are rarely stored. Existing RAW reconstruction methods can recover RAW data from sRGB images, but these approaches are typically optimized for pixel-wise RAW reconstruction fidelity and tend to degrade under diverse rendering styles and editing operations. We introduce a plug-and-play, edit-aware loss function that can be integrated into any existing RAW reconstruction framework to make the recovered RAWs more robust to different rendering styles and edits. Our loss formulation incorporates a modular, differentiable image signal processor (ISP) that simulates realistic photofinishing pipelines with tunable parameters. During training, parameters for each ISP module are randomly sampled from carefully designed distributions that model practical variations in real camera processing. The loss is then computed in sRGB space between ground-truth and reconstructed RAWs rendered through this differentiable ISP. Incorporating our loss improves sRGB reconstruction quality by up to 1.5-2 dB PSNR across various editing conditions. Moreover, when applied to metadata-assisted RAW reconstruction methods, our approach enables fine-tuning for target edits, yielding further gains. Since photographic editing is the primary motivation for RAW reconstruction in consumer imaging, our simple yet effective loss function provides a general mechanism for enhancing edit fidelity and rendering flexibility across existing methods.