TextNet is a deep learning architecture designed to bridge the gap between simple text detection and the complex reality of "irregular" text found in the wild. Unlike traditional OCR systems that struggle with non-linear or distorted text, TextNet provides an end-to-end solution for simultaneous localization and recognition.
The Challenge of Irregular Text
Most Optical Character Recognition (OCR) systems are optimized for "regular" text—straight, horizontal lines of characters. However, real-world scene text often contains words that are rotated, skewed by perspective, or curved (e.g., text on a coffee cup or a round logo).
Traditional approaches tackle this in two disconnected stages: first, a detector finds a bounding box; second, the box is cropped and sent to a recognizer. This pipeline approach suffers from two major flaws:
- Error Accumulation: If the detector slightly misses a character, the recognizer cannot recover it.
- Suboptimal Features: The detector and recognizer do not share information during training, meaning visual features are not optimized for both tasks simultaneously.
The TextNet Architecture
TextNet addresses these issues with a unified architecture consisting of four main components: a scale-aware backbone, a quadrangle text proposal module, a perspective RoI transform, and a spatial-aware recognition branch.
Key Components
- Scale-Aware Backbone: Based on ResNet-50, this component uses a scale-aware attention mechanism. Since text can appear at vastly different sizes, the network learns to adaptively weight features from different resolutions to create a robust feature map.
- Quadrangle Text Proposal: Instead of simple rectangular boxes, the network predicts four-point quadrangles. This allows it to tightly bound oriented and perspective-distorted text.
- Perspective RoI Transform: This is the core innovation. While standard RoI pooling works for axis-aligned boxes, TextNet uses a perspective transformation to warp an irregular quadrangle into a fixed-height, variable-width rectangular feature map. This preserves aspect ratios and character shapes, which is critical for recognition.
- Spatial-Aware Recognition: The recognition branch uses a two-layer RNN. The first layer encodes vertical context, and the second encodes horizontal context. It then employs a spatial attention mechanism to "attend" to specific parts of the feature map to decode characters sequentially.
Performance and Key Insights
The model was evaluated on several standard benchmarks, including ICDAR-2015 and Total-Text (a dataset specifically for curved text).
- State-of-the-Art on Irregular Text: On the Total-Text dataset, TextNet achieved an F-measure of 54.02%, significantly outperforming the two-stage baseline of 45.02%.
- Joint Training Bonus: One of the most interesting findings is that adding the recognition branch actually improves detection performance. By training both tasks together, the backbone learns richer representations that help it find text more accurately than a detector-only model.
- Efficiency: The model contains roughly 30 million parameters and processes an image in approximately 370ms on a Tesla P40 GPU. While not real-time, it is efficient enough for many industrial applications.
Conclusion
TextNet demonstrates that end-to-end training and perspective-aware transformations are essential for reading text in complex environments. While extremely complex "S-curves" or wrap-around text still pose challenges, the move toward flexible quadrangle proposals and spatial attention sets a new standard for robust OCR. Future work may involve moving toward mask-based detection or incorporating language models to further boost recognition accuracy.
Summary updated