Abstract
Recently, Vision-Language Pre-training (VLP) techniques have greatly benefited various vision-language tasks by jointly learning visual and textual representations, which intuitively helps in Optical Character Recognition (OCR) tasks due to the rich visual and textual information in scene text images. However, these methods cannot well cope with OCR tasks because of the difficulty in both instance-level text encoding and image-text pair acquisition. This paper presents a weakly supervised pre-training method, oCLIP, which can acquire effective scene text representations by jointly learning and aligning visual and textual information. Our network consists of an image encoder and a character-aware text encoder that extract visual and textual features, respectively, as well as a visual-textual decoder that models the interaction among textual and visual features for learning effective scene text representations. With the learning of textual features, the pre-trained model can attend texts in images well with character awareness. Besides, these designs enable the learning from weakly annotated texts (i.e. partial texts in images without text bounding boxes) which mitigates the data annotation constraint greatly. Experiments over the weakly annotated images in ICDAR2019-LSVT show that our pre-trained model improves F-score by +2.5% and +4.8% while transferring its weights to other text detection and spotting networks, respectively. In addition, the proposed method outperforms existing pre-training techniques consistently across multiple public datasets.
Introduction
Vision-Language Pre-training (VLP) has revolutionized how AI understands the relationship between images and text. However, popular models like CLIP struggle with Optical Character Recognition (OCR) tasks for two main reasons: granularity mismatch and the annotation bottleneck. Standard VLP models usually link an entire image to a single sentence, whereas scene text images contain many independent text instances (signs, labels, posters) that are not necessarily linguistically related. Furthermore, training high-quality OCR models typically requires "full annotations"—every piece of text must be transcribed and tightly bounded by a box—which is expensive and slow to produce at scale.
The authors introduce oCLIP (OCR Contrastive Language-Image Pre-training) to bridge this gap. oCLIP is designed to understand individual text instances and learn effectively from "weak" labels, such as text transcriptions without location boxes.
Methodology
The oCLIP architecture consists of three main components designed for fine-grained visual-textual alignment:
- Character-Aware Text Encoder (CAE): Unlike standard encoders that treat sentences as a sequence of words, the CAE operates at the character level. It encodes each text instance independently, preventing the model from learning spurious linguistic links between unrelated text instances in the same image.
- Visual-Textual Decoder (VTD): This component manages the alignment process using a transformer-based architecture. Text embeddings act as "queries" to probe image features. During training, the model performs a "fill-in-the-blanks" task: it masks a character in a word and forces the decoder to predict it using both the remaining text and visual features.
- Dual Loss Strategy: The model is optimized using both a Masked Character Prediction loss (for fine-grained alignment) and a Batch-level Contrastive Loss (to ensure the model can distinguish which text belongs to which image).
Crucially, because the decoder does not require spatial coordinates to perform character prediction, it can be trained on images where only the text content is known, not its location. This effectively turns a recognition task into a localization teacher.
Experiments and Results
The study utilizes several cornerstone OCR datasets, including SynthText for initial pre-training and ICDAR2019-LSVT for testing weakly supervised learning. Evaluations were also conducted on Total-Text and CTW1500 for curved text, and ICDAR2015 for incidental scene text.
Key results include:
- Weak Supervision Success: When pre-trained on weakly annotated LSVT images, oCLIP improved the F-score of standard detectors (like PSENet) by +2.5% and spotting networks by +4.8%.
- State-of-the-Art Gains: On the Total-Text dataset, oCLIP-enhanced models saw a +3.2% F-score boost, outperforming previous specialized pre-training methods like STKM.
- Scalability: When scaled to 40 million web images, the model achieved an impressive 87.0% F-score on Total-Text, demonstrating that the method thrives on large-scale, weakly labeled data.
Discussion and Conclusion
The success of oCLIP highlights that "language matters" for visual detection. By focusing on characters rather than tokens, the model develops a much finer attention for text regions. Attention maps show that oCLIP focuses on the entire span of a word, whereas general VLP models often fixate on just the first few letters. By explicitly ignoring the relationships between different text instances in an image, the model avoids learning false context, making it more robust when transferring to new environments.
While oCLIP shows impressive gains, future work could expand the language scope beyond English and Chinese to a truly multilingual setting. Additionally, while the model handles large datasets well, the computational cost of pre-training on 40 million images remains high. Nonetheless, oCLIP provides a robust framework for leveraging weak annotations to boost OCR performance.
Summary updated