Text Spotting Transformers

Xiang Zhang, Yongwen Su, Subarna Tripathi, Zhuowen Tu · DOI

Abstract

In this paper, we present TExt Spotting TRansformers (TESTR), a generic end-to-end text spotting framework using Transformers for text detection and recognition in the wild. TESTR builds upon a single encoder and dual decoders for the joint text-box control point regression and character recognition. Other than most existing literature, our method is free from Region-of-Interest operations and heuristics-driven post-processing procedures; TESTR is particularly effective when dealing with curved text-boxes where special cares are needed for the adaptation of the traditional bounding-box representations. We show our canonical representation of control points suitable for text instances in both Bezier curve and polygon annotations. In addition, we design a bounding-box guided polygon detection (box-to-polygon) process. Experiments on curved and arbitrarily shaped datasets demonstrate state-of-the-art performances of the proposed TESTR algorithm.

Introduction: Simplifying the Text Spotting Pipeline

Traditional text spotting—the simultaneous detection and recognition of text in images—has historically relied on complex, multi-stage pipelines. Most existing methods utilize "Region-of-Interest" (RoI) operations, such as RoI-Pooling or RoI-Align, to extract features from detected regions before passing them to a recognition module. While effective for standard horizontal text, these methods often struggle with "text in the wild," which frequently appears curved, rotated, or irregularly shaped.

Comparison of TESTR with previous text spotting pipelines. Note how TESTR (i) simplifies the process by removing complex grouping and RoI steps.

These legacy pipelines are often computationally expensive and require intricate heuristics or post-processing steps like Non-Maximum Suppression (NMS) to refine results. TESTR aims to overcome these limitations by treating text spotting as a direct set-prediction problem, utilizing a clean Transformer architecture that handles arbitrary shapes natively without the need for RoI-based cropping.

The TESTR Architecture

TESTR is built upon the Deformable DETR architecture, adapted specifically for the nuances of text. The framework employs a shared feature backbone (typically ResNet-50) and a Transformer encoder to process the input image. The core of the system lies in its dual-decoder design.

The detailed architecture of TESTR, featuring a shared encoder and specialized Location and Character decoders guided by a box-to-polygon process.

Dual-Decoder Design

Instead of a single sequential output, TESTR splits the processing into two specialized decoders:

  1. Location Decoder: This module regresses the coordinates of "control points" that define the text boundary. These points can represent either polygon vertices or Bezier curve control points, providing a flexible, unified representation for various text shapes.
  2. Character Decoder: This module predicts the sequence of characters within the identified boundary.

By sharing reference points between these decoders, TESTR ensures both modules attend to the same image features simultaneously. This eliminates the need for explicit feature warping or cropping, significantly simplifying the model's internal logic.

Box-to-Polygon Guidance

A key innovation in TESTR is the "box-to-polygon" detection process. Predicting complex polygons from scratch can be unstable. To mitigate this, a Guidance Generator first produces coarse bounding boxes. These boxes serve as a spatial prior, "guiding" the location decoder to refine these initial estimates into precise polygons or curves. This mechanism improved end-to-end recognition F-scores by over 5% in the authors' experiments.

Experimental Results

The authors evaluated TESTR on several challenging benchmarks, including Total-Text and CTW1500, which are specifically designed to test performance on curved and arbitrarily shaped text.

  • Total-Text: TESTR achieved a state-of-the-art F-score of 73.3% for lexicon-free end-to-end spotting, surpassing previous leading models like ABCNet v2 and MANGO.
  • CTW1500: The model reached an F-score of 56.0% (lexicon-free), representing a significant improvement over prior methodologies.
  • Efficiency: TESTR operates at approximately 5.3 to 5.5 FPS on high-end hardware. While not real-time, it offers a highly competitive balance of speed and accuracy for a Transformer-based model.

Discussion and Conclusion

TESTR demonstrates that Transformers can effectively unify text detection and recognition into a single, RoI-free framework. A notable finding was that the TESTR-Polygon variant often outperformed the Bezier curve version on highly irregular shapes, as polygons are not constrained by the fixed mathematical degree of a Bezier curve.

While the current model uses a fixed number of control points (e.g., 16), future work may explore adaptive point counts to better capture extremely long or complex text instances. Overall, TESTR sets a new standard for robust, end-to-end text spotting in unconstrained environments.

Summary updated

BibTeX
@misc{zhang2022text,
  author = {Xiang Zhang and Yongwen Su and Subarna Tripathi and Zhuowen Tu},
  title = {{Text Spotting Transformers}},
  year = {2022},
  eprint = {2204.01918},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2204.01918},
}
Figure