Transformer-based Image Compression with Variable Image Quality Objectives

Chia-Hao Kao, Yi-Hsin Chen, Cheng Chien, Wei-Chen Chiu, Wen-Hsiao Peng

TL;DR

This paper introduces a Transformer-based image compression system that uses prompt-tuning to navigate trade-offs between different quality metrics (like PSNR vs. MS-SSIM) within a single, shared model. By injecting adaptive prompt tokens into the architecture, the authors achieve performance comparable to specialized single-objective models while offering users the flexibility to tune visual characteristics at inference time.

What Problem Does This Paper Address?

In the world of learned image compression (LIC), "quality" is subjective. If you optimize a model for Mean Squared Error (MSE), you get high PSNR but often blurry results. If you optimize for Perceptual metrics (like LPIPS), you get sharp, visually pleasing images that might contain "hallucinated" textures or artifacts.

Traditionally, if a service provider wanted to offer both "High Fidelity" and "High Realism" modes, they would have to train and store two entirely separate models. This is a nightmare for storage and deployment. While some "conditional" models exist, they often focus only on variable bitrates or realism-vs-fidelity trade-offs on the decoder side. This paper tackles the challenge of creating a single model that can adapt its encoding and decoding processes to satisfy variable quality objectives based on a user-defined parameter ($\lambda$).

Methods

The authors build their framework on top of TIC (Transformer-based Image Compression), which utilizes Swin-Transformer Blocks (STB). Their secret sauce is the introduction of Prompt Generation Networks ($G_{enc}$ and $G_{dec}$).

Key Innovations:

  1. Adaptive Prompting: Instead of using static learnable tokens (standard in NLP prompt-tuning), they use small convolutional networks to generate prompts dynamically. These networks take the input image (or latent representation) and a "lambda map" (representing the desired trade-off) to create tokens that guide the Transformer.
  2. Modified Self-Attention: To integrate these prompts without breaking the Transformer's spatial structure, they modify the window-based multi-head self-attention (W-MSA). The prompt tokens are concatenated to the image tokens to form the Key ($K$) and Value ($V$) matrices, but the Query ($Q$) matrix is derived solely from the image tokens. This allows the prompts to influence the features while ensuring the output maintains the original image dimensions.
  3. Two Deployment Variants:
    • Both-side Prompts: Prompts are used in both the encoder and decoder. This specializes the bitstream for a specific objective, yielding the best rate-distortion performance.
  4. Decoder-side Only: Only the decoder is prompted. This allows a single bitstream to be "interpreted" in different ways (e.g., one file, but the user chooses to view it as "sharp" or "smooth").

Datasets

  • Training: The models were trained on the Flicker2W dataset (20,000 high-quality images).
  • Evaluation: Performance was benchmarked using the Kodak dataset, a standard set of 24 uncompressed images used in the compression community.

Key Insights and Ideas

  • The "Incompatibility" Discovery: One of the most interesting findings is that decoder-side-only conditioning fails when the two objectives are "incompatible," such as PSNR and MS-SSIM. If the encoder isn't "aware" of the objective, it may discard information necessary for one metric while optimizing for the other. In these cases, both-side prompting is essential.
  • Efficiency through Sparsity: The authors found that they only needed a prompt token count equal to one-quarter of the image tokens to achieve effective adaptation, keeping the added computational overhead low.
  • Prompting as a "Guide": By keeping the heavy backbone (the Swin-Transformer) frozen or shared and only adapting via prompts, the model learns to re-weight existing features rather than relearning how to compress from scratch for every metric.

Key Results

  • Competitive Performance: When using both-side prompts, the single model performs as well as (and sometimes slightly better than) "single-objective" models trained specifically for just one metric.
  • Smooth Transitions: The model demonstrates a smooth "morphing" of visual styles as $\lambda$ moves from 0 to 1. For example, in the (LPIPS, PSNR) pair, $\lambda=0$ produces smooth, high-PSNR images, while $\lambda=1$ produces sharp, high-detail images.
  • Storage Savings: By using one model with small "add-on" prompt networks (adding roughly 6 million parameters compared to the 15 million required by some competing methods like SFT), they significantly reduce the storage footprint for multi-objective systems.

Limitations and Future Work

  • The Decoder-Only Gap: As noted, the decoder-only version shows a significantly smaller range of adaptation for certain metric pairs. Finding a way to make a single bitstream more "universally decodable" across wider metric gaps remains a challenge.
  • Metric Expansion: The current work focuses on pairs of metrics (e.g., PSNR and LPIPS). Future work could explore multi-dimensional prompting to balance three or more objectives (e.g., Bitrate vs. PSNR vs. Realism) simultaneously.
  • Computational Overhead: While the prompt networks are relatively small, they still add a layer of complexity to the encoding/decoding pipeline that might impact real-time performance on mobile devices.

Summary updated

BibTeX
@inproceedings{kao2023transformer,
  author = {Chia-Hao Kao and Yi-Hsin Chen and Cheng Chien and Wei-Chen Chiu and Wen-Hsiao Peng},
  title = {{Transformer-based Image Compression with Variable Image Quality Objectives}},
  booktitle = {APSIPA ASC},
  year = {2023},
  url = {https://openreview.net/forum?id=6mCFkY49yo},
}

Loading related content...

Figure