Skip to main content
QUICK REVIEW

[Paper Review] Contextformer: A Transformer with Spatio-Channel Attention for Context Modeling in Learned Image Compression

A. Burakhan Koyuncu, Han Gao|arXiv (Cornell University)|Mar 4, 2022
Advanced Data Compression TechniquesComputer Science4 citations
TL;DR

This paper proposes Contextformer, a transformer-based context model with spatio-channel attention for learned image compression, which jointly models spatial and cross-channel dependencies in the latent space. By replacing the standard context model in a modern compression framework, Contextformer achieves up to 11% rate savings over VTM 16.2 and outperforms existing learning-based methods in PSNR and MS-SSIM across Kodak, CLIC2020, and Tecnick datasets.

ABSTRACT

Entropy modeling is a key component for high-performance image compression algorithms. Recent developments in autoregressive context modeling helped learning-based methods to surpass their classical counterparts. However, the performance of those models can be further improved due to the underexploited spatio-channel dependencies in latent space, and the suboptimal implementation of context adaptivity. Inspired by the adaptive characteristics of the transformers, we propose a transformer-based context model, named Contextformer, which generalizes the de facto standard attention mechanism to spatio-channel attention. We replace the context model of a modern compression framework with the Contextformer and test it on the widely used Kodak, CLIC2020, and Tecnick image datasets. Our experimental results show that the proposed model provides up to 11% rate savings compared to the standard Versatile Video Coding (VVC) Test Model (VTM) 16.2, and outperforms various learning-based models in terms of PSNR and MS-SSIM.

Motivation & Objective

  • To address the underutilization of spatio-channel dependencies in latent space for entropy modeling in learned image compression.
  • To improve context adaptivity by replacing non-adaptive masked convolutions with a dynamic, attention-based mechanism.
  • To develop an efficient inference pipeline that maintains high performance without increasing model size or requiring retraining.
  • To outperform state-of-the-art learning-based compression models and the VVC Test Model (VTM) 16.2 in rate-distortion performance.

Proposed method

  • Introduces a novel spatio-channel attention mechanism that generalizes standard self-attention to jointly model spatial and channel-wise dependencies in the latent tensor.
  • Designs a context model, Contextformer, based on the transformer architecture, where each token attends to spatial and channel-related features across the latent representation.
  • Employs a multi-head attention mechanism with learnable queries, keys, and values to dynamically adapt context based on input patterns.
  • Applies two algorithmic optimizations: Block-wise Decoding (BDS) and Segment-wise Coding Strategy (SCS) to reduce encoder runtime by enabling parallel processing.
  • Uses wavefront decoding in the decoder to enable parallelization and reduce decoding time, achieving 9x speedup over 3D context models.
  • Maintains the same model architecture and parameters as prior works while improving performance through architectural innovation and inference optimization.

Experimental results

Research questions

  • RQ1Can a transformer-based context model that jointly models spatial and cross-channel dependencies improve rate-distortion performance in learned image compression?
  • RQ2How does spatio-channel attention compare to standard spatial-only or channel-wise attention in terms of entropy modeling accuracy?
  • RQ3Can the computational cost of attention-based context models be reduced without sacrificing performance or requiring retraining?
  • RQ4What is the impact of coding order and channel segmentation on the information distribution and model performance?
  • RQ5How does the proposed model compare to VTM 16.2 and other learning-based models in terms of PSNR, MS-SSIM, and rate savings?

Key findings

  • Contextformer achieves an average of 6.9%–10.5% rate savings over VTM 16.2 across the Kodak, CLIC2020, and Tecnick datasets in terms of BD-Rate gain.
  • The model outperforms all evaluated learning-based baselines in both PSNR and MS-SSIM, demonstrating superior rate-distortion and perceptual performance.
  • Using a channel-first-order (cfo) coding strategy, Contextformer stores over 70% of the total information in the first two channel segments, indicating strong cross-channel dependency modeling.
  • The model with 4 channel segments achieves optimal trade-off between performance and complexity; further increases in segments yield only marginal gains at significantly higher training cost.
  • With the proposed BDS and SCS optimizations, the encoder runtime increases only 3x when scaling from Kodak (low-res) to 4K images, despite a 20x increase in pixel count.
  • Wavefront decoding enables 9x faster decoding compared to the 3D context model, demonstrating the effectiveness of parallelization in inference.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.