Multistage Spatial Context Models for Learned Image Compression

Fangzheng Lin, Heming Sun, Jinming Liu, Jiro Katto · DOI

TL;DR

This paper introduces "multistage spatial context models" for learned image compression, which break down the latent space into smaller patches and decode them in parallel stages. This approach achieves a significant speedup over traditional autoregressive models while matching or even surpassing their rate-distortion performance, and outperforming the checkerboard method.

What Problem Does This Paper Address?

Learned Image Compression (LIC) methods have achieved impressive results, often surpassing traditional codecs. A key component in many state-of-the-art LIC methods is the spatial context model, which uses previously decoded latent codes to predict the probability distribution of the current code, thereby improving compression efficiency. However, traditional autoregressive spatial context models decode latent codes serially, leading to slow compression and decompression times. While the "Checkerboard" context model offers parallel decoding, it comes at the cost of reduced rate-distortion (RD) performance. This paper addresses the challenge of achieving both fast parallel decoding and high RD performance in spatial context models for LIC.

Methods

The core innovation is the development of multistage spatial context models. Instead of a single autoregressive decoding pass, the latent space is divided into square patches (e.g., 2x2 or 4x4). Within each patch, latent codes are decoded autoregressively, but different patches can be decoded in parallel. This creates multiple decoding "stages" where, in each stage, one latent code from each patch is decoded.

A crucial aspect is the decoding order optimization algorithm. The authors recognize that the order in which latent codes are decoded within a patch significantly impacts performance. To find the optimal order without exhaustively training all possibilities (which becomes computationally infeasible for larger patch sizes), they employ a "Random Mask model." This model temporarily zeroes out context convolution weights, forcing the model to learn inferences from limited, randomly selected context positions. By evaluating the RD cost of different decoding orders using this model, they can identify the most efficient ones.

Datasets

  • Training: A subset of around 360,000 images from the Open Image Dataset.
  • Evaluation:
    • Kodak Image Dataset
    • CLIC Professional Dataset

Key Insights and Ideas

  • Parallelism is Key for Speed: Breaking down the latent space into parallelizable patches is the fundamental enabler for faster decoding.
  • Decoding Order Matters Significantly: A poorly chosen decoding order within a patch can severely degrade RD performance, even with parallel patch decoding.
  • Optimized Decoding Orders Unlock Performance: The proposed decoding order optimization algorithm is critical for realizing the full potential of multistage models, allowing them to match or exceed autoregressive performance.
  • Trade-off Between Stages and Patch Size: While more stages (larger patch divisions) can further reduce the proportion of "anchor" (context-less) codes, there are practical limits due to padding requirements and diminishing returns in context utilization. 2x2 and 4x4 patch sizes are identified as sweet spots.

Key Results

  • RD Performance: The proposed multistage context models (2x2 and 4x4) achieve RD performance comparable to, and in some cases better than, the autoregressive context model. They significantly outperform the Checkerboard model. For example, on Kodak, the 4x4 model shows around -2% RD cost compared to the 2x2 model. On CLIC, the 4x4 model shows over -5% RD cost compared to AR.
  • Runtime Performance: The multistage models are significantly faster than the autoregressive model. While slightly slower than the Checkerboard model due to more stages, this difference is deemed an acceptable trade-off for the superior RD performance. For instance, on RTX 3080 with N=M=128, AR takes 8574ms, Checkerboard 76ms, 2x2 best 85ms, and 4x4 best 97ms.
  • Decoding Order Impact: Ablation studies show that using the optimized decoding orders leads to lower RD costs, especially at lower bitrates, compared to less efficient orders like raster scan or the Checkerboard-like pattern.

Limitations and Future Work

  • Padding Issues: Larger patch sizes (e.g., 3x3) can lead to impractical padding requirements due to LCM calculations with existing LIC architectures.
  • Diminishing Returns: While larger patches might offer theoretical benefits, practical gains may plateau due to context utilization limits and increased complexity.
  • Future Work:
    • Integrating the proposed models with more recent state-of-the-art architectures.
  • Combining spatial context models with channel-wise context models to create more powerful channel-spatial context models.
  • Exploring larger patch sizes if padding issues can be effectively managed.

Summary updated

BibTeX
@inproceedings{lin2023multistage,
  author = {Fangzheng Lin and Heming Sun and Jinming Liu and Jiro Katto},
  title = {{Multistage Spatial Context Models for Learned Image Compression}},
  booktitle = {IEEE International Conference on Acoustics, Speech and Signal Processing},
  year = {2023},
  doi = {10.1109/icassp49357.2023.10095875},
}
Figure