Learned Image Compression with Text Quality Enhancement

Chih-Yu Lai, Dung N. Tran, Kazuhito Koishida · DOI

Abstract

Learned Image Compression (LIC) has demonstrated superior performance over traditional standards like JPEG and VVC for natural images. However, these models often struggle with Screen Content Images (SCIs), where text legibility is critical. This paper introduces a "plug-and-play" loss function termed text logit loss that optimizes compression models for semantic fidelity. By incorporating Optical Character Recognition (OCR) models into the training loop, the proposed method achieves a ~30% average reduction in bitrate for the same level of text accuracy compared to standard LIC methods.

Introduction

As deep neural networks become the backbone of modern image compression, the optimization objective typically remains Mean Squared Error (MSE) or Structural Similarity (SSIM). While effective for natural scenes, these metrics do not prioritize the sharp edges and semantic structures necessary for reading text. In Screen Content Images (SCIs)—such as website screenshots and digital documents—standard compression at low bitrates often results in "mushy" text that is visually recognizable as characters but semantically unreadable. This research addresses the gap between pixel-level fidelity and semantic legibility through a novel training objective.

Methodology: The Text Logit Loss

The core contribution of this work is the Text Logit Loss ($T$), a differentiable objective that can be integrated into existing LIC architectures. The training pipeline follows a four-step process:

  1. Text Detection: A pre-trained text detector (CRAFT) identifies bounding boxes for all text regions within the original input image ($x$).
  2. Cropping: These identified regions are cropped from both the original image and the reconstructed (compressed) image ($\hat{x}$).
  3. Feature Extraction (Logits): Both sets of crops are processed by a Scene Text Recognition (STR) model (PARSeq). Rather than using the final string predictions, the authors extract the logits—the raw, unnormalized values representing the model's confidence for each character class.
  4. Disparity Measurement: The loss is calculated as the MSE between the logits of the original and reconstructed text regions.

This loss is combined with the standard Rate-Distortion (R-D) objective to form the final training loss: $$L = \text{Rate} + \lambda \cdot \text{Distortion} + \kappa \cdot \text{Text Logit Loss}$$

The hyperparameter $\kappa$ allows for fine-tuning the balance between general visual quality and text legibility. By comparing logits rather than final text labels, the function provides a "soft" gradient that is more conducive to neural network optimization, capturing subtle confidence shifts that a hard string comparison would miss.

Experimental Setup

The researchers evaluated the text logit loss across five state-of-the-art compression models, including ELIC and Cheng 2020. The models were trained and tested using two primary datasets:

  • CIRCL Images AIL: Screenshots from onion domain websites (lossless PNG source).
  • Roboflow Website Screenshots: A synthetic dataset of over 1,000 top websites (lossy JPEG source), used to test generalization to pre-compressed content.

To ensure training efficiency, the text regions and logits for the original images were pre-calculated, requiring the OCR model to run only on the reconstructed images during the forward pass.

Results and Discussion

Quantitative Performance

The effectiveness of the method was measured using the Bjontegaard delta (BD) rate, which calculates the average bitrate savings for a given quality level. The proposed method achieved significant improvements in text recognition metrics:

  • Character Error Rate (CER): -32.64% BD-rate.
  • Word Error Rate (WER): -28.03% BD-rate.

These results indicate that the text-aware models can achieve the same level of OCR accuracy as standard models while using approximately 30% less data.

Qualitative Observations

Visual analysis confirms that at low bitrates (e.g., 0.1 bits per pixel), standard models produce distorted text where characters bleed into one another. In contrast, models trained with text logit loss maintain sharper edges and higher contrast in text regions. Interestingly, the researchers noted that while text legibility improved, the model sometimes sacrificed color accuracy in text regions to preserve character shapes, as the STR model is more sensitive to contrast than specific hue values.

Limitations and Future Work

While the framework is highly effective, it currently faces a few limitations:

  • Language Specificity: The current STR model is optimized for English; supporting non-Latin scripts would require swapping the recognition model.
  • Hyperparameter Sensitivity: The optimal value for $\kappa$ varies between different base architectures, requiring manual tuning.
  • Task-Aware Compression: This work serves as a foundation for "task-aware" compression, where images are optimized for downstream AI tasks—such as autonomous driving or automated document processing—rather than just human viewing.

Conclusion

By shifting the focus from pixel-perfect reconstruction to semantic preservation, the text logit loss provides a powerful tool for compressing screen content. The ability to "plug" this loss into existing architectures makes it a versatile solution for improving the utility of compressed images in an increasingly digital-first world.

Summary updated

BibTeX
@inproceedings{lai2024learned,
  author = {Chih-Yu Lai and Dung N. Tran and Kazuhito Koishida},
  title = {{Learned Image Compression with Text Quality Enhancement}},
  booktitle = {ICIP},
  year = {2024},
  doi = {10.1109/icip51287.2024.10647444},
}
Figure