Perceiving Stroke-Semantic Context: Hierarchical Contrastive Learning for Robust Scene Text Recognition

Hao Liu, Bin Wang, Zhimin Bao, Mobai Xue, Sheng Kang, Deqiang Jiang, Yinsong Liu, Bo Ren

Abstract

Scene Text Recognition (STR) is a critical task in computer vision, yet it remains challenging due to the immense variability in fonts, lighting, and semantic contexts found in natural environments. Traditional supervised methods are limited by the high cost of human labeling. This paper introduces PerSec (Perceiving Stroke-Semantic Context), a self-supervised framework that employs hierarchical contrastive learning to extract robust representations from unlabeled images. By analyzing both low-level character strokes and high-level semantic sequences, PerSec overcomes the limitations of previous "cross-sample" self-supervised methods. Evaluated on a new 100-million image dataset (UTI-100M), PerSec demonstrates superior performance and seamless integration with existing state-of-the-art architectures.

Introduction: The Challenge of Scene Text

Reading text from natural scenes—such as street signs, product labels, or receipts—requires models to handle significant "visual noise" and "semantic complexity." While supervised learning has made strides, its dependence on massive labeled datasets is a bottleneck.

Examples of scene text across different languages and environments.

Previous self-supervised learning (SSL) attempts, like SeqCLR, typically rely on comparing features across different images. This "cross-sample" approach often fails due to instance misalignment; for example, two different images of the same word may share no visual similarities. Furthermore, these methods often overlook the fundamental "atoms" of text: the character strokes. PerSec addresses these issues by focusing on the internal structure of a single image through intra-image contrastive learning.

Methodology: Hierarchical Contrastive Learning

The core of PerSec is the Context Perceiver (CP) module, which facilitates hierarchical contrastive learning. Instead of comparing different images, PerSec tasks the model with predicting masked portions of an image based on its surrounding context.

The overall architecture of PerSec, featuring dual Context Perceivers for stroke and semantic levels.

Dual Context Perceivers

The framework processes images at two distinct levels:

  1. Stroke Level: Captures fine-grained visual patterns like joints, endpoints, and radicals. This ensures the model understands the "geometry" of characters.
  2. Semantic Level: Captures high-level sequential meaning, allowing the model to learn the "language" of words.

The CP Module and Loss Functions

The CP module consists of a Context Aggregator, which uses Windowed Multi-Head Self-Attention (W-MHSA) to capture local "slow features," and a Quantizer, which maps continuous features into discrete "pseudo-labels" using Gumbel-Softmax. The model is optimized using a combined contrastive loss and a diversity loss, ensuring the learnable codebook is utilized effectively.

Datasets and Evaluation

To push the boundaries of SSL, the authors introduced UTI-100M, a massive dataset of 100 million unlabeled text line images harvested from real-world scenes. It spans five categories and four languages (Chinese, English, Japanese, and Korean).

Evaluation was conducted across standard benchmarks, including:

  • Regular: IC13, IIIT5K, SVT
  • Irregular: IC15, SVTP, CT80
  • Handwritten: IAM, CVL

Key Results and Insights

PerSec achieves a new state-of-the-art in unsupervised scene text recognition:

  • Unsupervised Superiority: PerSec outperformed SeqCLR by approximately 2% average accuracy across multiple benchmarks.
  • Plug-and-Play Performance: The pre-trained PerSec encoder can be integrated into existing models like SATRN or RobustScanner. For instance, it boosted SATRN's accuracy on the IC13 dataset from 94.2% to 97.2%.
  • The Power of Scale: Performance improved by over 4% when moving from smaller public datasets to the UTI-100M dataset, highlighting the effectiveness of hierarchical SSL at scale.

Conclusion and Future Work

PerSec demonstrates that learning from the internal stroke and semantic structure of images is a powerful alternative to traditional cross-sample contrastive learning. While the method requires careful hyperparameter tuning and significant computational resources, its robustness in data-scarce scenarios makes it highly valuable. Future research may extend this hierarchical approach to end-to-end text spotting or even broader linguistic datasets.

Summary updated

BibTeX
@inproceedings{liu2022perceiving,
  author = {Hao Liu and Bin Wang and Zhimin Bao and Mobai Xue and Sheng Kang and Deqiang Jiang and Yinsong Liu and Bo Ren},
  title = {{Perceiving Stroke-Semantic Context: Hierarchical Contrastive Learning for Robust Scene Text Recognition}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2022},
  doi = {10.1609/aaai.v36i2.20062},
}
Figure