TextTriangle: An end-to-end textspotter with piecewise linear alignment

Hui Xu, Qiufeng Wang, Zhenghao Li, Yu Shi, Xiangdong ZhouResearch Square 2022

Abstract

Scene text detection and recognition has attracted increasing research attention recently, especially for text of arbitrary shapes. In most of text spotting methods, text feature alignment is a key component to connect the detector and recognizer for end-to-end training. Existing alignment methods can be roughly categorized into those based on global consistent transformations and based on character-level classification. However, these methods either are unreliable for heavily deformed text or ignore contextual information in recognition. In this paper, we propose a novel textspotter named TextTriangle, which detects and recognizes text of arbitrary shapes in an end-to-end manner without character-level annotations. In TextTriangle, a text instance is described as a sequence of ordered triangles attached to each other. Based on this representation, a new PiecewiseAlign layer is designed to accurately extract features of the text instance with arbitrary shapes, which is the key to make the framework end-to-end trainable. Compared with the methods based on global consistent transformations, PiecewiseAlign adopts piecewise linear transformation for feature calculation. Experiments show that PiecewiseAlign is superior to TPS-based method in text alignment, and TextTriangle achieves competitive performance on standard scene text benchmarks.

Introduction

Reading text "in the wild"—on street signs, product packaging, or curved surfaces—is a two-step process called text spotting: first you detect where the text is, then you recognize what it says. The biggest hurdle today is "arbitrary-shaped" text. Most existing models try to "flatten" curved text using global transformations like Thin-Plate-Spline (TPS). However, global methods apply the same mathematical rules to the entire word; if one part of a word is stretched differently than another, the alignment fails, leading to distorted characters that the recognizer can't read. Other models solve this by labeling every single character during training, but this is incredibly labor-intensive and expensive.

The TextTriangle Framework

The authors introduce TextTriangle, which breaks away from global warping in favor of a "divide and conquer" approach. The entire system is end-to-end trainable using only word-level transcripts.

The TextTriangle architecture pipeline, showing the flow from detection to recognition via the PiecewiseAlign layer.

1. Text Representation and Detection

Instead of a simple box or a complex mask, a text instance is described as a sequence of ordered, adjacent triangles. Using a ResNet50 + FPN backbone, the model predicts geometric attributes—center line, height, and orientation—to calculate boundary points around the text.

2. PiecewiseAlign Layer

This is the core innovation. The model performs a Delaunay-style triangulation on the detected boundary points. It then applies a specific linear transformation to each individual triangle patch to map it onto a standardized rectangular grid. By treating a word as a mesh of triangles, the model can handle complex, non-linear deformations using simple, efficient linear math.

Comparison between TPS-based alignment and the proposed PiecewiseAlign. PiecewiseAlign preserves character shapes more accurately in curved text.

3. Text Recognition

Once the features are "flattened" by the PiecewiseAlign layer, they are fed into a lightweight CNN and an attention-based GRU decoder to predict the character sequence.

Key Insights

  • Local vs. Global: Different parts of a curved word have different degrees of deformation. A global TPS transformation often "over-corrects," distorting the ends of a word to fix the middle. Piecewise alignment ensures that a distortion in the first letter doesn't negatively impact the last letter.
  • Efficiency through Parallelism: Even though the alignment is "piecewise," the transformations for all triangle patches are computed in parallel, making it computationally efficient enough for end-to-end pipelines.

Experimental Results

TextTriangle was evaluated on four major industry benchmarks: Total-Text, CTW1500, ICDAR2015, and ICDAR2013. It achieved competitive results across the board, particularly on curved text benchmarks:

  • Total-Text: Achieved an F-measure of 85.1% for detection and 77.9% for end-to-end recognition (Full lexicon), outperforming several models that require character-level labels.
  • CTW1500: Reached an F-measure of 84.3% for detection and 73.9% for recognition.
  • Robustness: Qualitative results show that for heavily deformed words, TextTriangle preserved character shapes much better than TPS-based methods, which tended to blur or crop the characters at the edges.

Conclusion

While TextTriangle excels at handling the geometry of curved text, its performance in long text detection still has room for improvement. Future work will likely focus on enhancing the detector's ability to maintain consistency across very long sequences of triangles without losing alignment.

Summary updated

BibTeX
@inproceedings{xu2022texttriangle,
  author = {Hui Xu and Qiufeng Wang and Zhenghao Li and Yu Shi and Xiangdong Zhou},
  title = {{TextTriangle: An end-to-end textspotter with piecewise linear alignment}},
  booktitle = {Research Square},
  year = {2022},
  doi = {10.21203/rs.3.rs-1743583/v1},
}
Figure