Introduction
Scene text segmentation—the process of identifying pixel-level masks for text within natural images—is a critical precursor for advanced generative AI tasks, such as automated text removal, editing, and image inpainting. Despite its importance, current models often struggle with "blurry" boundaries. This lack of precision leads to significant artifacts in downstream applications: masks that are too small result in "ghosting" (remnants of the original text), while masks that are too large cause an unnecessary loss of background detail.
The Edge-Aware Challenge
The authors of EAFormer identify two primary hurdles in existing research. First, most current methods prioritize global text features or character recognition, often neglecting the high-frequency details at the edges. Second, popular benchmarks like COCO_TS and MLT_S frequently rely on coarse, bounding-box-style annotations that are insufficient for training or evaluating models on fine-grained edge accuracy.
Architecture: Integrating Classic Priors with Transformers
EAFormer (Edge-Aware Transformer) addresses these issues through a novel architecture that explicitly incorporates edge information.
- Text Edge Extractor: The model utilizes the classic Canny edge detection algorithm. To ensure the model focuses only on relevant data, a lightweight backbone predicts a coarse text mask, which is then used to filter the Canny output, retaining only the edges of text regions.
- Edge-Guided Encoder: Built upon the SegFormer framework, this module introduces a Symmetric Cross-Attention sub-module at the initial stage. This mechanism uses filtered edges as a "Query" to extract edge-aware visual information and simultaneously uses visual features to refine the edge data. This "early intervention" ensures the transformer prioritizes boundary details before resolution decreases in deeper layers.
- MLP-based Decoder: A lightweight decoder fuses multi-scale features from the encoder to generate the final high-resolution text mask.
Datasets and Re-annotation
The model was evaluated across six major benchmarks, including English (ICDAR13 FST, Total-Text, TextSeg) and Bi-lingual (BTS) datasets. Crucially, the authors manually relabeled COCO_TS and MLT_S to provide the community with pixel-accurate labels, as the original annotations were found to be too coarse for rigorous edge-accuracy evaluation.
Key Results and Downstream Impact
EAFormer establishes a new state-of-the-art (SOTA) across multiple benchmarks. It achieved 88.06% fgIoU on TextSeg and 88.08% on BTS. Its performance on the re-annotated COCO_TS dataset was particularly notable, outperforming the previous leader, TextFormer, by 12.09% in fgIoU.
The practical benefits of this precision are most evident in downstream tasks. When EAFormer’s masks are integrated into a pre-trained inpainting model, the resulting "erased" images are significantly cleaner and more realistic than those produced using standard segmentation methods.
Conclusion
EAFormer demonstrates that traditional computer vision techniques, like Canny edge detection, can serve as powerful spatial priors for modern Transformer architectures. By explicitly modeling edges and utilizing high-quality annotations, EAFormer achieves superior segmentation quality that directly translates to better performance in generative image editing. Future work will look toward making the edge extraction fully learnable and improving performance on heavily blurred text.
Summary updated