Contextformer: A Transformer with Spatio-Channel Attention for Context Modeling in Learned Image Compression
A. Burakhan Koyuncu, Han Gao, Atanas Boev, Georgii Gaikov, Elena Alshina, Eckehard Steinbach
TL;DR
This work introduces Contextformer, a transformer-based context model that extends attention to spatio-channel dependencies for learned image compression. By reorganizing latent representations into sequences and employing both spatial and cross-channel attention, the method achieves state-of-the-art rate-distortion performance, outperforming VTM 16.2 and several learning-based baselines on standard benchmarks. The paper also contributes practical runtime optimizations (BDS, SCS, and wavefront decoding) to mitigate the quadratic cost of attention, and provides extensive analyses on model size, generalization, and qualitative quality. Overall, Contextformer demonstrates the potential of adaptive, multi-dimensional attention for entropy modeling in learned compression, with meaningful gains in both objective metrics and visual fidelity.
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.
