wikillm

Paper · 2021-05-12 · cs.CV

TextOCR: Towards large-scale end-to-end reasoning for arbitrary-shaped scene text

TextOCR: about 903k word-level polygon annotations on 28k TextVQA images, used to train OCR models that beat COCO-Text-trained ones on most recognition benchmarks. PixelM4C plugs a frozen TextOCR-trained Mask TextSpotter v3 into M4C for end-to-end TextVQA; 42.12% val accuracy with ST-VQA data (author-reported).

Optical character recognitionVisual question answeringImage captioningocrscene-texttext-vqadatasetend-to-end

arXivPDFMarkdown9 min read

AI-compiled by claude-haiku-5-5 on 2026-11-06, not yet reviewed by a human. Every claim cites its source; check it when a detail matters.

In plain words

Reading text in photos, such as street signs, labels or posters, is harder than it looks for computers, and the best reading systems were trained on small or narrow collections of images. This paper builds a much larger, denser collection: photos that were already used for a question-answering dataset, with almost every word outlined and written out by hand. Models trained on it read text in new photos better than models trained on the older collections.

The paper then asks a related question. A system that answers questions about text in a photo usually runs a separate text reader first and passes its guesses on, so the answering model cannot tell the reader what it needed. The authors wire the reader and the answering model together so that the answering model's training signal can reach the reader. They also revisit several design choices of the earlier answering model and reach a higher score on its benchmark.

TL;DR

  • TextOCR is a dataset of about 903k non-empty word annotations on 28k photos from the TextVQA set, with arbitrary-shaped polygons §3.1 tab. 2.
  • Training recognizers on it beats COCO-Text-trained ones on most benchmarks, with large gains on TextOCR's own test set tab. 3.
  • PixelM4C connects a TextOCR-trained Mask TextSpotter v3 to M4C. It reaches 41.23% TextVQA val without ST-VQA data and 42.12% with it, against 40.55% for M4C with ST-VQA tab. 6. All numbers are author-reported.

Problem

Scene-text question answering (TextVQA, TextCaps) depends on an OCR system, and at the time the paper argues that OCR is the bottleneck. The authors name three gaps: little ground-truth text on the real photos these tasks use, OCR training sets that are small or focus on outdoor and storefront scenes, and no end-to-end training from the answer back to the reader §1. Existing OCR sets also have few words per image, so they are poor at text-dense scenes §1 tab. 2.

Method

Dataset (TextOCR). Source images are the TextVQA set §3.2. Every word gets a polygon. Only Latin words are transcribed; non-Latin and illegible words get a "." label. A word is an uninterrupted run of letters §3.1. Annotators draw a rectangle for near-horizontal words and a multi-point polygon for curved ones, keeping reading direction from the first to the second point §3.1. Annotation UI details are in app. A. Authors audit the work and send re-annotation feedback §3.1.

Dataset statistics. Images: 21,749 train, 3,153 val, 3,232 test (28,134 total). Non-empty words: 714,186 / 108,386 / 80,497 (903,069). Labeled instances including empty words: 1,320,064. Words per image: 32.1 on average tab. 2 §3.2. Alphanumeric words with 3 or more characters: 522,665. Rotated (over 20°) words: 150,197. Curved words: 19,310 tab. 2. Table 1 compares these figures with other datasets; its train/test split for TextOCR counts validation images inside train tab. 1.

Text recognition models. The authors use the Baek et al. benchmark code (CRNN, Rosetta, STAR-Net and TPS-ResNet-BiLSTM-Attn) app. C. Each model is either trained from scratch on COCO-Text or TextOCR, or fine-tuned from an existing checkpoint on TextOCR §4.1 §4.2. Word accuracy is the share of words predicted perfectly app. C.

End-to-end text spotting. Mask TextSpotter v3 (official code) is trained from scratch on COCO-Text or TextOCR, or its official weights are fine-tuned on TextOCR and Total-Text §4.1 §4.2. Evaluation follows the ICDAR 2015 protocol with polygon support §4.3 app. C.

PixelM4C. The model runs M4C on top of a TextOCR-trained MTS v3 §5.2 fig. 1. The steps are:

  1. MTS v3 is frozen. Its OCR tokens and per-token features are extracted on the fly during training §5.2.
  2. The per-token feature is the last hidden state of the prediction decoder at the end-of-sequence token. The authors found it better than the fc7 feature used by M4C §5.2 tab. 6.
  3. Tokens are filtered by confidence: no detection threshold, recognition threshold 0.2 app. F. MTS v3's default is 0.2 for detection and 0.8 for recognition app. F.
  4. Up to 200 OCR tokens are passed to M4C, with a 5k answer vocabulary as in M4C §5.2 app. E app. F.
  5. A captioning variant (PixelM4C-Captioner) follows the same pattern for TextCaps §5.2 tab. 6.
Pseudocode
# PixelM4C forward pass (TextVQA)  [§5.2] [app. F]
# Input:  image (3, H, W); question tokens; object features
# Output: answer scores over the vocabulary and the OCR tokens

def pixel_m4c_forward(image, question, object_features):
    # 1. Run the frozen MTS v3 trained on TextOCR  [§5.2]
    ocr_tokens, ocr_boxes, ocr_scores = mts_v3(image)
    # 2. Keep tokens that pass the recognition threshold 0.2  [app. F]
    kept = [t for t in ocr_tokens if t.rec_score >= 0.2]
    # 3. Use the decoder's last hidden state at <EOS> as the feature  [§5.2]
    ocr_features = [t.last_hidden_at_eos for t in kept]
    # 4. Cap at 200 tokens; the selection order is not stated  [app. E]
    ocr_features = ocr_features[:200]    # (N <= 200, d)
    # 5. Predict with M4C given question, objects and OCR tokens  [§5.2]
    return m4c(question, object_features, ocr_features)

Training uses M4C's hyperparameters and the 5k vocabulary, with batch size 16 instead of 128 §5.2 app. F. The loss is not restated in this paper; it reuses the M4C setup §5.2. Adding ST-VQA as extra annotation data follows M4C §5.2 app. F.

Hyperparameters

NameValueWhereNotes
Recognizer optimizerAdaDelta, decay rate 0.95app. CBaek et al. settings; no learning rate stated
Recognizer batch size192app. C
Recognizer gradient clippingmagnitude 5app. C
Recognizer iterations, from scratch200kapp. CConflicts with 100k in §4.1, see Pitfalls
Recognizer iterations, fine-tune100kapp. C4 V100 GPUs app. C
MTS v3 optimizerSGD, momentum 0.9, weight decay 1e-4app. C
MTS v3 learning rate1e-3, divided by 10 every 100kapp. C300k iterations total
MTS v3 batch size8app. Crotation augmentation between -90° and 90°
MTS v3 multi-scale short side800, 1000, 1200, 1400 (random)app. Cevaluation short side 1000
MTS v3 backbone initResNet-50 pretrained on ImageNet§4.1for training from scratch
MTS v3 hardware8 V100 GPUs, distributedapp. C
PixelM4C optimizerAdam, lr 1e-4§5.2
PixelM4C betas0.9, 0.999 (captioner: 0.9, 0.99)app. F
PixelM4C warmuplinear, 1000 iterations§5.2 app. F
PixelM4C schedulelr /10 at 14k and 19k; max 24k§5.2 app. Fcaptioner: /10 at 10k and 11k; max 12k
PixelM4C batch size16§5.2 app. FM4C uses 128 §5.2
PixelM4C OCR tokens200§5.2 app. EM4C used 50
PixelM4C OCR thresholdsdetection: none; recognition: 0.2app. Fa sweep is claimed, numbers not shown
PixelM4C MTS v3frozen§5.2fine-tuning heads reported to hurt
PixelM4C hardware16 V100 GPUs, distributed, MMF framework§5.2

Results

Author-reported. Setups: recognizers are Baek et al.'s code; end-to-end is MTS v3; TextVQA is val accuracy with M4C as baseline.

Text recognition, word accuracy tab. 3

SettingMetricBaselineThis paperSource
TPS-ResNet-BiLSTM-Attn, from scratch, COCO-Text vs TextOCRTextOCR test43.2065.65tab. 3 rows 1–2
sameICDAR 201564.0580.07tab. 3 rows 1–2
CRNN, S90k+ST vs +TextOCR fine-tuneTextOCR test43.0758.61tab. 3 rows 3–4
Rosetta, S90k+ST vs +TextOCR fine-tuneTextOCR test43.1660.85tab. 3 rows 5–6
STAR-Net, S90k+ST vs +TextOCR fine-tuneTextOCR test48.2366.84tab. 3 rows 7–8
TPS-ResNet-BiLSTM-Attn, S90k+ST vs +TextOCR fine-tuneTextOCR test50.3769.49tab. 3 rows 9–10
TPS-ResNet-BiLSTM-Attn, S90k+ST vs +TextOCR fine-tuneICDAR 201578.2485.15tab. 3 rows 9–10

End-to-end text spotting, F-measure tab. 4

SettingTotal-Text (none)Total-Text (full)COCO-TextTextOCRSource
MTS v3, official weights71.278.446.134.9tab. 4 row 7
MTS v3, fine-tuned on TextOCR74.581.657.950.8tab. 4 row 8

TextVQA val accuracy tab. 6

SettingBaselineThis paperSource
PixelM4C, MTS v3 trained on TextOCR, LH featureM4C 39.4041.23tab. 6 row 9 vs row 2
PixelM4C with ST-VQAM4C w/ ST-VQA 40.5542.12tab. 6 row 10 vs row 3
PixelM4C with TextOCR annotations as OCR source (not a deployable setting)M4C 39.4046.36tab. 6 row 12

TextCaps val CIDEr tab. 6: M4C-Captioner 89.60 (row 2). PixelM4C-Captioner with TextOCR-trained MTS v3 and LH feature: 85.32 (row 9). The authors report no significant gain on TextCaps except BLEU-4 §5.2.

OCR upper bounds on TextVQA val tab. 5: Rosetta OCR UB 44.98, MTS v3 53.34, TextOCR annotations 66.90. OCR+vocabulary UB: 79.72, 80.64, 87.22. Human accuracy is 85.01. The UB uses multi-word matching, not the metric from the original TextVQA paper, so these are not directly comparable with it §5.1.

Same-number-of-instances check app. D: TextOCR-4055 outperforms ICDAR15-trained models on 6 of 7 standard benchmarks (the exception is ICDAR15 itself). TextOCR-38839 outperforms COCO-Text on 5 of 7.

Paper vs code

No official code. Searched: the paper's footnotes (only Mask TextSpotter v3 and deep-text-recognition-benchmark, both third-party to this paper, and the MMF citation); the project page textvqa.org/textocr (fetch returned no content); a GitHub repository search for "pixelm4c" and "textocr" (empty or unauthorised); facebookresearch/mmf/projects, which has m4c and m4c_captioner but whose README describes M4C only, with no PixelM4C or Mask TextSpotter code. The paper's own code is not located, so no discrepancies can be checked.

Pitfalls

  • Percentage wording. Section 4.1 says TextOCR-trained models are "22.45% better" and "10.56% better" §4.1. Table 3 shows these are absolute differences in points (65.65 − 43.20 and 64.03 − 53.47), not relative gains.
  • Heuristic gains. The text says OCR UB is "11% and 22% higher" for TextOCR than for MTS v3 and Rosetta §5.1. Table 5 gives 66.90 vs 53.34 (13.56 points) and 66.90 vs 44.98 (21.92 points). Neither matches 11%. Use the table values.
  • Training length conflict. Section 4.1 says cross-dataset models train from scratch for 100k iterations. Appendix C says 200k for from-scratch runs and 100k for fine-tuning. Check the run you implement.
  • Annotations as OCR source. Rows 11–13 of Table 6 feed ground-truth TextOCR annotations to the model. The authors say they do not claim state of the art for these rows, since training directly on TextOCR would be non-ideal for the community §5.2 (footnote). Do not treat these numbers as a deployable result. The reported 6% gain is 6.6 points for fc7 (row 11 vs row 8) and 5.1 for LH (row 12 vs row 9) tab. 6.
  • Token count sweep. The text says more tokens help app. E caption. In the sweep, 200 tokens with TextOCR (46.12) scores below 100 tokens (46.42). The 200-token MTS v3 (TextOCR-en) entry (39.41) equals the 100-token entry, which may be a copy error. The ordering of the kept tokens is not stated.
  • Thresholds. The PixelM4C thresholds (no detection threshold, 0.2 recognition) come from a sweep whose results are not shown app. F. MTS v3's defaults differ.
  • Batch size. The claim that batch 16 beats 128 rests on a sweep described as "details in appendix" §5.2. The appendix gives only the conclusion app. F.
  • Captioner Adam β2. The hyperparameter table in app. F lists β2 = 0.999 for PixelM4C and 0.99 for the captioner. The text does not mention this difference.
  • Headline claim uses extra data. The 42.12% result uses ST-VQA. Without it the best PixelM4C is 41.23% tab. 6 and the matched M4C baseline is 39.40%.
  • Fixed upstream OCR. MTS v3 is frozen in PixelM4C. The authors say fine-tuning its predictor heads hurt, possibly because MTS v3 is trained with character-level and M4C with word-level losses §5.2. No numbers are given.
  • Dataset licence. The paper does not state a licence for the TextOCR annotations. Images come from TextVQA and OpenImages; a footnote in Section 2 and the appendix credit CC BY 2.0 Flickr photos §2 app. G. The licence of this card covers the paper only. Check the dataset's own terms before using its data, and do not publish its images.
  • Word-level metric. Word accuracy counts only perfectly predicted words app. C. Empty and non-Latin words are excluded from training counts (non-empty 903k vs 1.32M labeled) tab. 2.
  • Averages in §4.1. The claims of 2.5% and 0.3% average gains over ICDAR15 and COCO-Text §4.1 do not say which benchmarks enter the average. Use the per-benchmark numbers in Table 3 and the same-number experiment app. D.

Lineage

  • Builds on: M4C, an iterative answer-prediction transformer for TextVQA [hu2020iterative]. PixelM4C keeps M4C's setup and changes the OCR source and features §5.2.
  • Builds on: Mask TextSpotter v3 as the end-to-end OCR module [liao2020maskv3]. Its official code is used for the recognition and spotting experiments app. C.
  • Compared against: CRNN, Rosetta, STAR-Net and TPS-ResNet-BiLSTM-Attn for recognition tab. 3; Qin et al., Mask TextSpotter v2, Boundary TextSpotter and ABCNet for end-to-end spotting tab. 4; COCO-Text and Total-Text as training and test sets.
  • Superseded by: not known from content in this wiki.

Source and license

Adapted from “TextOCR: Towards large-scale end-to-end reasoning for arbitrary-shaped scene text” by Amanpreet Singh, Guan Pang, Mandy Toh, Jing Huang, Wojciech Galuba, Tal Hassner (arXiv:2105.05486), used under CC BY 4.0. Changes: condensed and restructured for implementation, with tables, equations and algorithms taken from the paper and its code, each cited to its source. Not affiliated with or endorsed by the authors.