InstructOCR: Instruction Boosting Scene Text Spotting

Chen Duan, Qianyi Jiang, Pei Fu, Jiamin Chen, Shengxi Li, Zining Wang, Shan Guo, Junfeng Luo

Abstract

In the field of scene text spotting, previous OCR methods primarily relied on image encoders and pre-trained text information, but they often overlooked the advantages of incorporating human language instructions. To address this gap, we propose InstructOCR, an innovative instruction-based scene text spotting model that leverages human language instructions to enhance the understanding of text within images. Our framework employs both text and image encoders during training and inference, along with instructions meticulously designed based on text attributes. This approach enables the model to interpret text more accurately and flexibly. Extensive experiments demonstrate the effectiveness of our model and we achieve state-of-the-art results on widely used benchmarks. Furthermore, the proposed framework can be seamlessly applied to scene text VQA tasks. By leveraging instruction strategies during pre-training, the performance on downstream VQA tasks can be significantly improved, with a 2.6% increase on the TextVQA dataset and a 2.1% increase on the ST-VQA dataset. These experimental results provide insights into the benefits of incorporating human language instructions for OCR-related tasks.

Introduction

Scene text spotting—the combined task of detecting and recognizing text in natural images—has advanced rapidly. However, most existing models rely almost exclusively on image encoders, treating all text within an image with equal priority. This approach overlooks a critical component of human perception: intent. In real-world scenarios, humans often search for specific text attributes, such as a street name or a word of a certain length.

InstructOCR addresses this gap by introducing human language instructions into the scene text spotting pipeline. By allowing natural language prompts to guide the visual recognition process, the model bridges the gap between raw pixels and human-centric tasks.

InstructOCR uses linguistic instructions to focus the spotting task, such as identifying words of a specific length.

Methodology

The InstructOCR framework utilizes an encoder-decoder architecture designed for deep interaction between visual and linguistic features.

The InstructOCR architecture integrates a learnable text encoder and an image encoder via cross-attention to produce instruction-aware features for the decoder.

Architecture Components

The model consists of four primary stages:

  1. Image Encoder: A standard ResNet50 backbone extracts visual features from the input image.
  2. Text Encoder: Unlike many predecessors that use frozen weights, InstructOCR employs a 12-layer BERT model that is actively trained to extract linguistic features from instructions.
  3. Fusion via Cross-Attention: The model uses a cross-attention mechanism to align the visual features from the image with the linguistic features from the instructions. This creates "instruction-based encoded features."
  4. Sequence-based Decoder: Following the Single-Point Text Spotting (SPTS) approach, an auto-regressive Transformer predicts a sequence of tokens representing the text's center point $(x, y)$ and the transcription.

Automated Instruction Generation

To avoid the high cost of manual labeling, the authors developed a method to automatically turn existing OCR annotations into instructions. They designed 10 templates based on text attributes like length, specific characters, or whether the text is numerical or alphabetical. This allows for zero-cost scaling of the training data.

Experiments and Results

The model was evaluated across several diverse benchmarks, including Total-Text (arbitrary shapes), ICDAR2015 (multi-oriented text), and ICDAR2013 (horizontal text).

Scene Text Spotting

InstructOCR achieved state-of-the-art (SOTA) performance across multiple metrics:

  • Total-Text: Surpassed previous point-based methods (SPTS-v2) by 1.6% in lexicon-free settings.
  • ICDAR2015: Showed a significant 6.3% improvement over the SPTS-v1 baseline, highlighting the robustness of instruction-based spotting in complex, multi-oriented text environments.

Scene Text VQA

When applied to Scene Text Visual Question Answering (VQA) tasks, the instruction-based pre-training strategy led to a 2.6% increase on TextVQA and a 2.1% increase on ST-VQA. Despite having only 78M parameters—significantly smaller than multi-billion parameter Large Vision-Language Models—InstructOCR achieves competitive results, proving that task-specific instruction tuning is highly efficient.

Discussion and Conclusion

The core insight of this work is that instructions serve as a powerful linguistic prior. By telling the model what to look for (e.g., "Text starts with the character 'A'"), the search space for the decoder is effectively narrowed, leading to higher precision in cluttered or "noisy" scenes. Furthermore, the paper demonstrates that "active" text encoding (training the BERT layers) is superior to using frozen embeddings, allowing the model to truly synthesize the command with visual evidence.

While the model's performance is currently capped by the relatively small amount of scene text data (0.2M images) compared to massive general-purpose datasets, InstructOCR provides a scalable and efficient framework for incorporating human intent into OCR tasks.

Summary updated

BibTeX
@misc{duan2024instructocr,
  author = {Chen Duan and Qianyi Jiang and Pei Fu and Jiamin Chen and Shengxi Li and Zining Wang and Shan Guo and Junfeng Luo},
  title = {{InstructOCR: Instruction Boosting Scene Text Spotting}},
  year = {2024},
  eprint = {2412.15523},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2412.15523},
}
Figure