Goal Conditioned Reinforcement Learning for Photo Finishing Tuning

Jiarui Wu, Yujin Wang, Lingen Li, Zhang Fan, Tianfan Xue

TL;DR

This paper introduces an automatic photo-tuning framework that uses goal-conditioned reinforcement learning (RL) to optimize parameters in black-box, non-differentiable image processing pipelines like Adobe Lightroom. By treating the pipeline as a black box and leveraging a novel state representation, the method finds the optimal slider settings in just 10 queries—achieving superior image quality up to 260 times faster than traditional optimization or proxy-based approaches.

What Problem Does This Paper Address?

When photographers retouch photos in software like Adobe Lightroom or Darktable, they manually adjust a series of non-destructive sliders (e.g., exposure, contrast, white balance). Automating this process to match a specific "target" look is highly challenging because commercial image processing pipelines (ISPs) are non-differentiable black boxes.

Previous automation attempts fall into two categories, both with major drawbacks:

  1. Zeroth-order optimization (e.g., CMA-ES): These gradient-free search methods are extremely slow, often requiring hundreds of queries to the pipeline to find the right parameters.
  2. Differentiable proxies: These methods train a neural network to approximate the behavior of the ISP. However, they struggle to accurately reproduce complex or dynamically reconfigurable pipelines, suffer from high memory consumption (leading to out-of-memory errors at high resolutions), and generalize poorly to unseen styles.

The authors tackle this by asking: Can we design an efficient parameter-searching algorithm that treats the pipeline as a true black box without relying on a finicky neural proxy?

Methods

The authors propose a goal-conditioned reinforcement learning framework based on the Twin Delayed DDPG (TD3) algorithm. Instead of blindly guessing parameters, an RL agent learns a policy that iteratively adjusts the pipeline's sliders based on the current image and the target "goal" image.

Figure 2: The overall framework. Top row: at each step, our policy maps the current image and the goal image to action (new parameters), with the help of our state representation consisting of dual-path features, photo statistics, and historical actions. Bottom row: visualization of iterative tuning trajectory of our RL-based photo finishing framework.

The core innovation lies in their specialized Photo Finishing State Representation, which consists of three components:

  • Dual-path Feature Representation: A CNN encoder that splits into a local path (to preserve spatial resolution for textures, highlights, and shadows) and a global path (to capture overall color, tone, and scene category).
  • Photo Statistics Representation: Standard CNNs struggle with global image properties due to limited receptive fields. To fix this, the authors explicitly extract RGB histograms, luminance, median, contrast, and saturation from both the current and goal images, mapping them through a linear layer.
  • Historical Actions Embedding: Tracks parameters from previous steps and their corresponding $\ell_2$ distances to the goal to help the agent understand its trajectory.

The framework supports two tasks via distinct reward functions:

  • Photo Finishing Tuning: The goal image has the same content but a different style. The reward is the step-by-step improvement in Peak Signal-to-Noise Ratio (PSNR).
  • Photo Stylization Tuning: The goal is an arbitrary style image with different content. The reward uses a VGG-19 Gram matrix style score combined with luminance/color histogram alignment, penalized by content changes.

Datasets

The framework was trained and evaluated using several datasets:

  • MIT-Adobe FiveK Dataset: Contains 5,000 RAW photos retouched by five experts. 4,500 images were used for training, and 500 for validation.
  • Lightroom Discover Images: A curated set of 200 diverse style images used exclusively to evaluate the photo stylization task.
  • HDR+ Dataset: A separate dataset of 153 scenes used to test cross-dataset generalization without any additional training.

Key Insights and Ideas

  • Predicting Directions vs. Blind Searching: Traditional zeroth-order search methods take a long time because they sample randomly. The RL policy learns the underlying structure of the editing space, allowing it to accurately predict the direction the sliders need to move, cutting the search path down drastically.
  • The Power of Explicit Statistics: Relying solely on deep neural networks to understand photo style often fails when encountering out-of-distribution images. Explicitly feeding traditional photographic statistics (like histograms) into the RL state allows the model to generalize remarkably well to completely unseen styles.
  • True Black-Box Universality: Because the RL agent only interacts with the pipeline by inputting parameters and receiving an output image, it requires zero knowledge of the pipeline's internal code or gradients. This makes it fully compatible with any commercial software.

Key Results

The RL-based method significantly outperforms baseline approaches in both speed and image quality.

Figure 1: In this work, we propose an RL-based photo finishing tuning algorithm that efficiently tunes the parameters of a black-box image processing pipeline to match any tuning target. The RL-based solution (top row) takes only about 10 iterations to achieve a similar PSNR as the 500-iteration output of a zeroth-order algorithm (bottom row). Our method demonstrates fast convergence, high quality, and no need for a proxy.

Quantitative Performance (Photo Finishing)

On the MIT-Adobe FiveK dataset, the method achieved a 35.89 dB PSNR in just 10 queries. In comparison, CMA-ES achieved only 28.53 dB after 200 queries, while proxy methods hovered around 21–22 dB.

Efficiency and Resolution Scalability

Because the RL policy runs inference on downscaled ($64 \times 64$) images to determine slider positions before applying them to the full-resolution image, it bypasses memory bottlenecks:

  • At 720P resolution: The method is 260 times faster than the Cascaded Proxy method.
  • At 4K resolution: It processes an image in 1.23 seconds, whereas CMA-ES takes 144.02 seconds (a 117x speedup), and proxy methods completely fail due to Out-of-Memory (OOM) errors.
Figure 3: Photo finishing tuning results on FiveK dataset with expert C target. The visual results of our method are closest to the target image, especially in terms of color and brightness.

Photo Stylization

User studies showed that participants overwhelmingly preferred the stylization results of this method over proxies and zeroth-order optimizations, noting that it matched the target color and brightness much more faithfully.

Figure 4: Photo stylization tuning results. Compared with CMAES [9, 20], monolithic proxy [28], and cascaded proxy [29], our output matches the best with the style goal.

Limitations and Future Work

While highly effective, the authors note a couple of limitations:

  • Image-Only Conditioning: The framework currently only accepts a target image as the goal condition. It cannot interpret text-based instructions (e.g., "make the sunset warmer").
  • Future Directions: The next step for this research is to expand the framework to support multi-modal conditional inputs, allowing users to guide the automated tuning process using a mix of text prompts and reference images.

Summary updated

BibTeX
@inproceedings{wu2024goal,
  author = {Jiarui Wu and Yujin Wang and Lingen Li and Zhang Fan and Tianfan Xue},
  title = {{Goal Conditioned Reinforcement Learning for Photo Finishing Tuning}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=4kVHI2uXRE},
}
Figure