Abstract
Handwritten Text Recognition (HTR) has traditionally transitioned from explicit character detection to implicit sequence modeling using Recurrent Neural Networks (RNNs) and autoregressive Transformers. While effective, these sequence-heavy models often suffer from high computational costs and a lack of interpretability. This paper introduces DTLR (Detection-based Text Line Recognition), a framework that treats text recognition as a parallel object detection task. By adapting the DINO-DETR architecture and utilizing a synthetic-to-real training pipeline, DTLR achieves state-of-the-art results on Chinese scripts and historical ciphers. The model offers significant improvements in inference speed—performing up to four times faster than autoregressive counterparts—while providing transparent, box-level localization for every character.
Introduction
For decades, the field of Handwritten Text Recognition (HTR) has grappled with the inherent complexity of human script: overlapping characters, inconsistent styles, and the scarcity of character-level bounding box annotations. To bypass these hurdles, the industry moved toward "implicit" recognition methods. Models like TrOCR or RNN-based architectures predict characters sequentially, treating the image as a sequence rather than a collection of distinct objects.
However, this sequential approach introduces two primary drawbacks. First, it is computationally inefficient; predicting a line of $N$ characters requires $N$ forward passes through the decoder. Second, these models function as "black boxes," making it difficult to diagnose whether a failure stems from a localization error or a classification error. DTLR addresses these issues by returning to explicit detection, leveraging modern Transformer-based detectors to identify all characters in a text line simultaneously.
Methodology
Architecture: DINO-DETR Adaptation
DTLR utilizes DINO-DETR, a state-of-the-art transformer-based object detector. The process begins with a Convolutional Neural Network (CNN) backbone that extracts high-level features from the input image. These features are refined by a transformer encoder. Finally, a transformer decoder uses a set of "queries" to predict bounding boxes and character classes for the entire line in a single parallel pass.
Training Pipeline
To overcome the lack of character-level labels in real-world datasets, the authors employ a multi-stage training strategy:
- Synthetic Pre-training: The model is first trained on massive synthetic datasets where bounding boxes are known. This phase teaches the model the fundamental geometry of characters across various fonts and scripts.
- Masking Strategy: During training, certain characters are randomly masked. This forces the model to rely on surrounding context, effectively training an internal language model that can infer missing or ambiguous characters.
- Fine-tuning with Adapted CTC: To bridge the gap to real-world data (which typically only provides line-level text labels), the authors use a modified Connectionist Temporal Classification (CTC) loss. This allows the model to refine its predictions on real images without requiring explicit bounding box labels for the fine-tuning set.
Experimental Results
Performance and Versatility
DTLR was evaluated across a diverse range of scripts, including Latin (IAM, RIMES), Chinese (CASIA v2), and historical ciphers (Borg, Copiale).
- Chinese HTR: On the CASIA v2 dataset, DTLR achieved a 97.34% Correct Rate, establishing a new state-of-the-art benchmark.
- Historical Ciphers: The model excelled in low-resource environments, ranking first in the ICDAR 2024 Competition on Handwriting Recognition of Historical Ciphers. Its ability to handle esoteric symbols demonstrates its robustness beyond standard alphabets.
- Latin Scripts: While highly competitive, DTLR remains slightly behind the most advanced autoregressive models on Latin datasets like IAM, primarily because those models integrate much larger, pre-trained language models.
Efficiency and Interpretability
One of the most significant advantages of DTLR is its speed. On an A6000 GPU, DTLR processes a text line in approximately 67ms, compared to 284ms for TrOCR. This 4x speedup is a direct result of the parallel detection architecture.
Furthermore, DTLR provides "Zero-Shot Localization." A model pre-trained on Latin fonts can often localize Chinese characters or unknown cipher symbols with surprising accuracy, as it learns the general visual properties of what constitutes a "character." This provides researchers with visual evidence (bounding boxes) to verify why a model succeeded or failed.
Discussion and Limitations
Despite its successes, the authors noted specific areas for future refinement. During extended fine-tuning on Chinese scripts, the model occasionally suffers from "box degeneration," where bounding boxes shrink or overlap despite high text accuracy. This suggests that incorporating stronger geometric constraints could further stabilize training.
Additionally, the model currently relies on a simple N-gram approach for language refinement. Integrating a more sophisticated language model, such as a small-scale LLM, could potentially close the performance gap on Latin scripts where linguistic context is paramount.
Conclusion
DTLR represents a significant shift back toward detection-based recognition in the era of Transformers. By proving that explicit detection is not only viable but superior in terms of speed and interpretability, the authors provide a robust alternative to the sequential status quo. DTLR is particularly well-suited for complex scripts and historical documents where traditional language models are difficult to apply.
Summary updated