Deep Lossy Plus Residual Coding for Lossless and Near-Lossless Image Compression

Yuanchao Bai, Xianming Liu, Kai Wang, Xiangyang Ji, Xiaolin Wu, Wen Gao

TL;DR

This paper introduces the Deep Lossy Plus Residual Coding (DLPR) framework, a novel unified approach for both lossless and near-lossless image compression using deep learning. DLPR achieves state-of-the-art compression performance while also offering competitive coding speeds, making it practical for high-resolution image applications.

What Problem Does This Paper Address?

High-fidelity image compression is crucial for professional fields like medicine and remote sensing, where even minor distortions can be problematic. While traditional codecs offer both lossless (perfect reconstruction) and near-lossless (bounded error) modes, existing deep learning-based compression methods primarily focus on lossy compression and struggle to achieve true lossless or near-lossless performance. Furthermore, achieving near-lossless compression often requires training separate models for different error bounds, which is inefficient. This paper aims to bridge this gap by proposing a single, unified deep learning framework capable of both lossless and scalable near-lossless image compression.

Methods

The core of the DLPR framework is a two-stage approach:

  1. Lossy Image Compression (LIC): The initial stage uses a sophisticated deep neural network (encoder-decoder with Swin-Attention blocks and a hyper-prior model) to compress the input image into a latent representation. This stage is trained to minimize a combination of rate and distortion.
  2. Residual Compression (RC/SQRC): The difference (residual) between the original image and its lossy reconstruction is then compressed.
  3. Lossless Mode: For lossless compression, an autoregressive model with a novel context design is used to compress the residuals, aiming to approximate the true probability distribution of the residuals.
  4. Near-Lossless Mode: To achieve near-lossless compression with a bounded error ($\ell_\infty$ constraint), the residuals are first quantized to satisfy the specified error bound. A key innovation here is the Scalable Quantized Residual Compressor (SQRC), which allows a single network to handle variable error bounds by deriving the probability model of quantized residuals from the learned model of original residuals, avoiding the need for multiple specialized networks. SQRC also incorporates a bias correction mechanism to address mismatches between training and inference.

To accelerate the process, the authors introduce:

  • Novel Context Design: Dividing images into patches and using a specific scan order to enable more parallel processing of autoregressive models.
  • Adaptive Residual Interval: Dynamically adjusting the range of residuals to be encoded based on the image content, reducing the complexity of entropy coding.

Datasets

  • Training: DIV2K high-resolution training dataset (800 2K RGB images).
  • Evaluation:
    • ImageNet64 (downsampled ImageNet validation set)
    • DIV2K validation dataset
    • CLIC.p (professional validation dataset)
    • CLIC.m (mobile validation dataset)
    • Kodak dataset (24 uncompressed color images)
    • Histo24 (24 uncompressed histological images)

Key Insights and Ideas

  • Unified Framework: The most significant insight is the development of a single deep learning framework that effectively handles both lossless and near-lossless compression, a feat not previously achieved by learning-based methods.
  • Lossy-Plus-Residual for Lossless: The paper demonstrates that a well-designed lossy compression stage followed by efficient residual coding can achieve state-of-the-art lossless compression, challenging the notion that only purely lossless methods are suitable.
  • Scalable Near-Lossless Compression: The SQRC is a crucial contribution, enabling flexible near-lossless compression without retraining for different error bounds. This is achieved by cleverly leveraging the learned probability models of original residuals.
  • Practicality through Acceleration: The novel context design and adaptive residual interval are key to making these deep learning models practical for real-world applications by significantly improving coding speed.

Key Results

  • Lossless Compression: DLPR achieves state-of-the-art lossless compression performance, outperforming traditional codecs and many recent learning-based methods across various datasets. It achieves the best performance on DIV2K, CLIC.p, CLIC.m, Kodak, and Histo24, and is second best on ImageNet64.
  • Near-Lossless Compression: The DLPR system with SQRC significantly outperforms traditional near-lossless codecs (WebP nll, JPEG-LS, CALIC) by a wide margin, offering better rate-distortion performance for variable $\ell_\infty$ bounds.
  • Rate-Distortion: For near-lossless compression, DLPR consistently yields the best rate-distortion performance, even when compared to lossy codecs at high bit rates.
  • Runtime: The DLPR system achieves competitive coding speeds, with lossless compression being almost as fast as FLIF and significantly faster than other learned methods like L3C and Minnen[MSE]. Near-lossless compression is even faster due to the adaptive residual interval.

Limitations and Future Work

  • Decoding Speed: While competitive, the decoding speed of the lossless DLPR is still slower than some traditional codecs.
  • Generalization: While the model shows good generalization across different datasets, performance on ImageNet64 is slightly lower than a specialized model trained on that domain.
  • Future Work: The paper implicitly suggests further exploration of context models and adaptive interval schemes for even greater speed improvements. The authors also mention the potential for further optimization of the LIC and residual compressor architectures.

Summary updated

BibTeX
@article{bai2024deep,
  author = {Yuanchao Bai and Xianming Liu and Kai Wang and Xiangyang Ji and Xiaolin Wu and Wen Gao},
  title = {{Deep Lossy Plus Residual Coding for Lossless and Near-Lossless Image Compression}},
  journal = {IEEE Trans. Pattern Anal. Mach. Intell.},
  year = {2024},
  doi = {10.1109/tpami.2023.3348486},
}
Figure