HLIC: Harmonizing Optimization Metrics in Learned Image Compression by Reinforcement Learning

Baocheng Sun, Meng Gu, Dailan He, Tongda Xu, Yan Wang, Hongwei QinarXiv 2021

Abstract

Learned image compression is making good progress in recent years. Peak signal-to-noise ratio (PSNR) and multi-scale structural similarity (MS-SSIM) are the two most popular evaluation metrics. As different metrics only reflect certain aspects of human perception, works in this field normally optimize two models using PSNR and MS-SSIM as loss function separately, which is suboptimal and makes it difficult to select the model with best visual quality or overall performance. Towards solving this problem, we propose to Harmonize optimization metrics in Learned Image Compression (HLIC) using online loss function adaptation by reinforcement learning. By doing so, we are able to leverage the advantages of both PSNR and MS-SSIM, achieving better visual quality and higher VMAF score. To our knowledge, our work is the first to explore automatic loss function adaptation for harmonizing optimization metrics in low level vision tasks like learned image compression.

Introduction

In the field of learned image compression (LIC), researchers face a persistent challenge known as the "metric tug-of-war." Optimizing a neural network for Peak Signal-to-Noise Ratio (PSNR) often results in high pixel accuracy but visually blurry reconstructions. Conversely, optimizing for Multi-Scale Structural Similarity (MS-SSIM) tends to preserve textures better but can introduce color shifts or lower mathematical fidelity.

Conceptual illustration of the trade-off between PSNR and MS-SSIM optimization.

Traditional approaches involve training separate models for each metric, which is rigid and fails to find a globally optimal balance. Manual weight tuning for hybrid loss functions is a tedious process of trial and error that rarely generalizes across different bitrates. HLIC addresses this by introducing a Reinforcement Learning (RL) agent that dynamically tunes the loss function during the training process, acting as a "teacher" to guide the compression model toward a superior perceptual balance.

Methodology

The HLIC framework treats training as a bi-level optimization problem consisting of an inner and an outer loop.

Inner Loop: The Compression Model

The inner loop utilizes a standard LIC architecture (such as Ballé et al., 2018). The model learns to compress images by minimizing a weighted loss function that combines rate and distortion (MSE and MS-SSIM). This model acts as the "student" that adapts its parameters based on the loss weights provided by the RL agent.

Outer Loop: The RL Teacher

A Reinforcement Learning agent, specifically using Proximal Policy Optimization (PPO), acts as the "teacher." It monitors the training progress by evaluating validation results (PSNR, MS-SSIM, and bitrate) on the Kodak dataset. Based on these observations, the agent decides how to adjust the weights ($\lambda$) of the loss function for subsequent training epochs.

Key technical innovations include:

  • Dynamic Adaptation: Unlike fixed hybrid losses, weights are adjusted "on the fly" as the model learns.
  • Exponential Reparameterization: To handle the logarithmic relationship between weights and bitrate, the agent predicts $\lambda'$ where $\lambda = e^{\lambda'}$, facilitating smoother convergence.
  • Baseline-Relative Reward: The agent is rewarded for improvements relative to two baseline curves—one optimized purely for PSNR and the other for MS-SSIM—encouraging the model to find a "sweet spot" that outperforms single-metric baselines.

Experimental Results

The framework was trained on 8,000 high-resolution images from ImageNet and validated on the Kodak dataset. Testing was conducted on the Tecnick dataset to ensure the results generalize to unseen data.

Ablation study on the Kodak dataset, demonstrating the performance of HLIC variants against standard baselines.

Key Findings:

  • Synergistic Optimization: One of the most significant findings is that skillfully incorporating Mean Squared Error (MSE) into the loss function can actually improve MS-SSIM performance slightly while significantly boosting PSNR.
  • Superior Perceptual Quality: HLIC models achieved higher VMAF scores (a metric designed to predict human-perceived quality) compared to standard MS-SSIM-optimized models. Qualitatively, HLIC avoids the "color shift" artifacts common in MS-SSIM models and the "blurriness" common in MSE models.
  • Stability and Controllability: The use of PPO with a trajectory length of 10 was found to be essential for stable loss adaptation. Furthermore, by adjusting the reward function, the framework can be "steered" to prioritize specific metrics based on application needs.

Conclusion

HLIC demonstrates that Reinforcement Learning can effectively harmonize conflicting optimization metrics in image compression. While an inherent Pareto frontier exists between PSNR and MS-SSIM, HLIC pushes the boundaries of this trade-off, offering a flexible and automated alternative to manual loss tuning. This work opens the door for automatic loss function adaptation in other low-level vision tasks where human perception is difficult to capture with a single mathematical formula.

Summary updated

BibTeX
@misc{sun2021hlic,
  author = {Baocheng Sun and Meng Gu and Dailan He and Tongda Xu and Yan Wang and Hongwei Qin},
  title = {{HLIC: Harmonizing Optimization Metrics in Learned Image Compression by Reinforcement Learning}},
  year = {2021},
  eprint = {2109.14863},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2109.14863},
}
Figure