TextAnchor-26M: Robust OCR Anchoring Dataset
- TextAnchor-26M is a large-scale dataset that provides 26.7M image–text pairs with fine-grained binary masks for precise text anchoring.
- It incorporates diverse data sources including scene text, synthetic typography, and academic documents to ensure varied language and layout representations.
- It employs rigorous annotation strategies and stochastic prior injection to optimize spatial grounding and enhance model training in OCR tasks.
TextAnchor-26M is a large-scale dataset conceived to support reliable text anchoring in optical character recognition (OCR)-oriented vision-LLMs (VLMs). It provides 26.7 million image–text instances, each meticulously annotated with a fine-grained binary mask localizing the queried textual element. Developed to facilitate causal, query-conditioned visual grounding, TextAnchor-26M addresses the pressing need for robust spatial supervision in tasks that require models to not only recognize textual content but also precisely associate text with its spatial extent in diverse visual contexts (Xu et al., 31 Mar 2026).
1. Dataset Scale and Composition
TextAnchor-26M comprises approximately 26.7 million image–text pairs. Each data point contains one transcript—representing a line of text or query—and an associated binary mask precisely indicating its image region. The dataset does not provide a predefined validation or test split; all data are employed in Stage 1 pre-training, except for a reserved subset of 10,000 VQA (visual question answering) instances used in Stage 2.
The underlying sources and scale are itemized as follows:
| Source | # Instances | Usage |
|---|---|---|
| Scene text | 14.4 M | Stage 1 |
| Synthetic (SynthDog) | 10.8 M | Stage 1 |
| Academic docs (MinerU) | 1.53 M | Stage 1 |
| VQA w/ causal mask | 10 K | Stage 2 |
- Scene text: Sourced from Wukong and TextDiffuser MARIO-10M, pseudo-labeled via multi-engine consensus.
- Synthetic typography: Generated by SynthDog with diverse fonts and languages.
- Academic document pages: Based on arXiv PDF pages parsed by MinerU at the line level.
- VQA with causal mask: SVRD dataset instances and VLM-prompted responses.
This broad composition ensures substantial diversity in language, font, layout, and scene complexity for robust downstream evaluation and pre-training.
2. Annotation Methodology
Annotation leverages several strategies to optimize both precision and generality:
- Multi-engine consensus (scene text): Two off-the-shelf OCR engines (PPOCR-V5, docTR) generate candidate bounding boxes and transcripts; results are retained only if the boxes are mutually best IoU matches () and transcripts match exactly after whitespace normalization. Disagreements may be adjudicated by a large VLM; unresolved cases are discarded.
- Academic pages: MinerU extracts line-level text and associated confidence scores; low-confidence samples (MinerU score < 0.7) are filtered using PaddleOCR-VL.
- Synthetic text (SynthDog): Text is rendered with multilingual support and style variation; ground-truth boxes are known from the rendering pipeline.
- De-stylized mask rendering: For each line, the referenced transcript is re-rendered using standard fonts (Ubuntu Regular for Latin, Noto Sans SC for CJK) on a blank canvas. Foreground masks are extracted, cropped, and resized to the target box, yielding binary (0/255) masks that represent the text region without preserving original style, color, or background.
- Stochastic Prior Injection (SPI): During training, each sample is randomly assigned a prior state :
- : Clean OCR-derived or ground-truth priors provided.
- : Half of priors intentionally corrupted (box jitter, transcript deletion/insertion/removal).
- : All priors are omitted.
Corruption rates and distributions are empirically calibrated from observed PPOCR-V5 error statistics on HierText, ensuring realistic prior degradations.
3. Data Format and Storage
Data is stored as standard JPEG or PNG images, with annotations serialized in line-delimited JSON. Each entry contains:
2
- Images: Stored as JPEG/PNG, sourced per the acquisition strategy outlined above.
- Masks: Delivered as binary PNG images, optionally in COCO-style RLE. Masks are de-stylized: they outline character-level foregrounds while abstracting away from original typographic or background features.
- Transcripts: Textual line or query for the instance; language distribution spans English, Chinese, and mixed pairs. No explicit language tags are provided, but these can be inferred.
- No reading order annotations are present; all instances are independent at the line or query level.
4. Statistical Analysis and Distribution
The dataset reflects notable characteristics across sources and modality:
- Language: Scene text is predominantly English (14.4 M), synthetic split covers English and Chinese (10.8 M), with document instances primarily bilingual (1.53 M).
- Box and mask sizes: Scene-text boxes span 1–3% of image area on average; document lines average 0.2–1%. Box aspect ratios are unconstrained and vary substantially from signage to single-word labels.
- Spatial coverage: Instances mask approximately 5–30% of their respective image content, with broader coverage in scene images than document pages.
- Source diversity: Incorporation of pseudo-labeled, synthetic, and document-centric samples enhances statistical and structural heterogeneity.
This diversity facilitates robust evaluation and pre-training efficacy for spatial text anchoring in heterogeneous visual environments.
5. Spatial Priors and Quality Assurance
Spatial priors are systematically encoded in the dataset:
- Priors injection: Priors derived from OCR predictions or ground-truth rendering may be clean, partially corrupted, or omitted during training (SPI, see above). These are provided to the model for optional cross-attention.
- Annotation quality: Multi-engine consensus on scene text imposes strict entry criteria (IoU ≥ 0.7 and transcript exact match) to minimize localization errors.
- Mask supervision: De-stylized masks enforce tight alignment to foreground glyphs, serving as the ground-truth signal for mask decoders.
This structured approach injects robust spatial priors while accounting for noise typical in real-world OCR outputs.
6. Evaluation Metrics and Training Losses
Model evaluation and training employ the following protocols:
- Mask-to-prediction alignment (IoU):
- Region-to-Text accuracy:
- Text-to-Region F1: Assessed by greedy bipartite matching under the constraint .
- Model losses:
These criteria directly target both the spatial fidelity and content accuracy of text anchoring.
7. Practical Usage, Access, and Preprocessing
Data loading follows standard machine learning practices and is illustrated by a PyTorch Dataset class:
3
Preprocessing guidance includes:
- Resizing images so that the longest side is approximately 1,600 pixels.
- Masks are normalized to 0 or binarized to 1.
- Tokenization of transcripts should follow VLM-specific conventions.
Typical entry examples demonstrate the format for scene text and academic documents. Masks, stored as PNGs, outline only the de-stylized glyph silhouette in tight correspondence with the textual region.
In summary, TextAnchor-26M establishes a comprehensive corpus designed for stable evaluation and training of fine-grained text-region grounding in vision-LLMs. Its design—spanning multi-source construction, precise de-stylized mask rendering, and stochastic prior perturbations—provides a robust foundation for developments in causal, query-driven text anchoring in OCR-focused research (Xu et al., 31 Mar 2026).