Introduction
Text segmentation—the task of identifying exactly which pixels belong to a character—is a critical yet often overlooked component of the computer vision pipeline. While scene text detection and optical character recognition (OCR) have advanced significantly, precise pixel-level masks are essential for sophisticated downstream applications like automated text removal or style transfer. Generic semantic segmentation models frequently struggle with text due to its non-convex boundaries, diverse textures, and varying scales. To address these challenges, this paper introduces TextSeg, a large-scale dataset, and TexRNet, a specialized refinement network.
The TextSeg Dataset
Existing text segmentation datasets are often limited in scale or focus solely on simple scene text. The authors present TextSeg, a comprehensive benchmark comprising 4,024 images. This dataset is distinguished by its diversity, including both "Scene Text" (e.g., billboards) and "Design Text" (e.g., artistic posters and digital logos).
TextSeg provides six types of labels, including word/character polygons and transcriptions. A key innovation is the inclusion of word-effect masks, which allow models to distinguish between the core glyph and decorative elements like shadows or glows.
TexRNet: A Text-Specific Refinement Approach
The proposed TexRNet (Text Refinement Network) acts as a specialized "polishing" layer integrated with standard backbones like DeepLabV3+ or HRNet. It treats text as a distinct structural entity through three primary mechanisms:
- Key Features Pooling & Attention: By identifying high-confidence text regions, the network uses their features to "rescue" low-confidence regions with similar textures, ensuring consistency across words.
- Trimap Loss: This loss function prioritizes boundary accuracy, focusing the model's learning on the transition zones between text and background.
- Glyph Discriminator: A pre-trained, frozen character classifier acts as a "judge." If a segmented shape does not resemble a recognizable letter (a "glyph"), the discriminator penalizes the model, thereby preserving the structural integrity of the text.
Results and Discussion
TexRNet achieves state-of-the-art performance across multiple benchmarks. On the TextSeg dataset, the combination of TexRNet and HRNetV2-W48 reached a foreground Intersection over Union (fgIoU) of 86.84%, a ~2% improvement over the baseline.
The model demonstrates particular robustness in handling thin strokes and complex backgrounds where standard models often fail. Furthermore, the high-quality masks generated by TexRNet significantly enhance the visual realism of downstream tasks like text removal and style transfer.
Conclusion and Future Work
While TexRNet sets a new standard for text segmentation, it relies on character-level bounding boxes for its Glyph Discriminator, which may not be available in all datasets. Future research could explore extending this approach to non-Latin scripts with higher structural complexity and optimizing the computational efficiency of the attention and discriminator components.
Summary updated