Char-SAM: Turning Segment Anything Model into Scene Text Segmentation Annotator with Character-level Visual Prompts

Enze Xie, Jiahao Lyu, Daiqing Wu, Huawen Shen, Yu Zhou

TL;DR

Char-SAM is a training-free pipeline that transforms the Segment Anything Model (SAM) into a high-quality, low-cost annotator for scene text. By introducing character-level bounding boxes and "glyph-aware" point prompts, it overcomes SAM's tendency to misinterpret text structures, producing pixel-perfect masks that rival human-annotated datasets.

What Problem Does This Paper Address?

Scene text segmentation—the task of identifying the exact pixels belonging to letters in an image—is crucial for applications like "magic eraser" photo editing and augmented reality translation. However, creating these datasets is a nightmare; pixel-level annotation is incredibly labor-intensive.

While the Segment Anything Model (SAM) has revolutionized general segmentation, it performs poorly on text. The authors identify two main "failure modes" for SAM in this domain:

  1. Insufficient Granularity: Word-level bounding boxes are too coarse, leading SAM to miss individual character boundaries.
  2. Structural Confusion: Even with character-level boxes, SAM often fails to recognize "holes" in letters (like the center of an 'O' or 'D') as background, or it under-segments large, stylized characters because it doesn't understand the underlying "glyph" structure.

Methods

Char-SAM solves these issues through a two-stage refinement pipeline that requires zero additional training:

  • Character Bounding-box Refinement (CBR): Most existing datasets only provide word-level boxes. CBR uses a pre-trained text detector (CRAFT) and a watershed algorithm to automatically "break" word boxes into precise, individual character boxes.
  • Character Glyph Refinement (CGR): This is the "secret sauce." Since SAM doesn't know what an 'A' or a 'B' is supposed to look like, the authors provide it with a prior. They use a library of 80 different fonts to create "glyph templates" for each character. By "voting" across these templates, they identify pixels that are almost certainly foreground (the ink) and pixels that are likely holes (the background). These are fed into SAM as positive and negative point prompts, guiding the model to respect the character's topology.

The final output is a high-fidelity mask generated by SAM, guided by both a box and specific "ink" vs. "hole" points.

Datasets

The researchers evaluated their method on:

  • TextSeg: A high-quality benchmark for scene text segmentation.
  • COCO-Text & MLT17: Large-scale text detection datasets. The authors used Char-SAM to convert these into new, high-quality segmentation datasets named COCO_TS_refined and MLT_S_refined.

Key Insights and Ideas

  • Glyphs as Priors: SAM is a "generalist" model. By feeding it glyph-based point prompts, the authors are essentially giving the model a "cheat sheet" of text geometry. This allows a general-purpose model to behave like a text specialist.
  • The "Hole" Problem: One of the most interesting findings is how poorly SAM handles the internal topology of letters. The use of negative point prompts specifically for the "holes" in characters like 'P', 'R', and 'B' is a simple but highly effective fix for over-segmentation.
  • Training-Free Scalability: Because the system doesn't require training, it can be deployed immediately to turn millions of existing (and cheaper) bounding-box annotations into expensive pixel-level masks.

Key Results

  • Near-Supervised Performance: In a zero-shot setting (no training on the target data), Char-SAM achieved an 84.80% fgIoU on the TextSeg dataset. This is remarkably close to the current state-of-the-art supervised model, TFT, which reaches 87.11% after extensive training.
  • Ablation Success: Moving from word-level boxes to character-level boxes improved the F-score from 83.52% to 87.81%. Adding the Glyph Refinement (CGR) pushed it further to 92.15%.
  • Better Training Data: When a standard segmentation model (TextRNet) was trained using Char-SAM's "refined" labels instead of older pseudo-labels, its performance improved by 3.5% in F-score, proving that Char-SAM generates significantly cleaner data than previous automated methods.

Limitations and Future Work

  • Dependency on Detection: The pipeline's success relies on the initial character detector (CRAFT) and recognizer. If the system misidentifies a 'G' as a 'C', the glyph prompts will be incorrect, leading to a poor mask.
  • Language Constraints: The current implementation focuses on English/Latin characters based on their font library. Expanding this to complex scripts like Chinese or Arabic would require building more diverse glyph template libraries.
  • Artistic Distortion: While the voting mechanism handles various fonts, extremely distorted or "liquified" artistic text might still fall outside the consensus of the 80-font template library.

Summary updated

BibTeX
@inproceedings{xie2025char,
  author = {Enze Xie and Jiahao Lyu and Daiqing Wu and Huawen Shen and Yu Zhou},
  title = {{Char-SAM: Turning Segment Anything Model into Scene Text Segmentation Annotator with Character-level Visual Prompts}},
  booktitle = {IEEE International Conference on Acoustics, Speech and Signal Processing},
  year = {2025},
  doi = {10.1109/icassp49660.2025.10888943},
}
Figure