In this paper we investigate the generalization capability of state-of-the-art object detection models (Hi-SAM, YOLO, and RT-DETR) for the automatic segmentation of text lines in historical documents. Generalization is needed because it is not practical for museums and archives to produce large amounts of labeled samples for each new collection. We also evaluate the few-shot setting by fine-tuning the networks with only a small number of training samples per target dataset. To this end, we use nine different datasets that differ significantly in visual layout and language. Additionally, we discuss why mean average precision (mAP), a classic evaluation metric for object detection, is insufficient for assessing the quality of a text line segmentation model. Depending on the dataset, our CRNN models achieve character error rates (CER) ranging from 2.48% to 7.07% per page for the segmented text lines. This is sufficient for reading comprehension and simple text searches. Finally, we quantify the resource and time requirements of training and inference in different use case settings. This forms the basis for more informed decisions about model and hardware choices based on available resources.
Figures & tables
English
Norwegian
Swedish
German
Mix Dataset
Bentham Sánchez (2016)
NorHand 72702 Beyer and Solberg (2023)
NorHand 331861 Beyer and Solberg (2023)
Riksarkivet BK 1 Riksarkivet (2024)
Riksarkivet BK 2 Riksarkivet (2024)
Riksarkivet GBG 1 Riksarkivet (2024)
Riksarkivet GBG 2 Riksarkivet (2024)
READ 2016 Sanchez et al. (2016)
Nuremberg LB 3 Mayr et al. (2025)
Mix
Time
19th century
19th/20th century
18th century
19th century
15th-19th century
15th century
Pages
Train
350
292
319
184
175
208
146
350
433
336
Val
50
37
40
23
22
26
18
50
55
47
Test
33
37
40
24
22
27
19
50
53
46
Total
433
366
399
231
219
261
183
450
541
429
Table 1: Dataset statistics for the ten datasets used in the study. The table reports the number of pages and text lines in the training, validation, test, and total splits. Underlined datasets have been used as source domains for training.
Figure 1: Visual overview of all used datasets. The documents vary in language, handwriting style, and paper color. Some documents are more prone to bleed-through effects than others.
Tested on
Training Dataset
Line Detector
Bentham
NorHand 72702
NorHand 331861
Riksarkivet BK 1
Riksarkivet BK 2
Riksarkivet GBG 1
Riksarkivet GBG 2
READ 2016
Nuremberg LB 3
NorHand-331861
Hi-SAM
49.64
58.00
75.53
68.05
62.02
55.62
47.15
28.77
41.29
YOLO
39.51
52.89
81.67
74.78
71.31
58.53
48.72
21.31
19.86
RT-DETR
12.05
15.81
37.22
16.58
27.50
15.85
13.10
07.41
05.27
READ 2016
Hi-SAM
32.17
35.85
41.74
29.22
33.85
38.43
33.75
79.01
49.08
YOLO
25.26
13.98
13.35
24.43
21.74
34.94
27.65
81.12
28.22
Table 2: Cross-dataset evaluation of three line detectors trained on four datasets and tested on nine datasets. Performance is reported as mAP, where higher value is better.
Figure 2: Qualitative comparison. The first row shows ground-truth bounding boxes; the remaining rows show the corresponding predictions from each line detection model on samples from the nine datasets used in this study.
Figure 3: Two ways IoU 0.5 overlap can occur. The blue box is the ground-truth bounding box. The red box is the predicted bounding box.
Tested on
Training Dataset
Line Detector
Bentham
NorHand 72702
NorHand 331861
Riksarkivet BK 1
Riksarkivet BK 2
Riksarkivet GBG 1
Riksarkivet GBG 2
READ 2016
Nuremberg LB 3
OOD AVG gap with Baseline
Baseline
GT-Boxes
2.22
1.61
3.09
3.40
2.48
4.60
2.96
3.99
5.02
NorHand-331861
Hi-SAM
5.03
3.56
3.65
4.72
3.53
8.81
13.82
13.46
14.05
5.09
YOLO
7.47
6.64
3.48
4.93
5.93
9.67
14.13
14.82
39.90
9.65
RT-DETR
26.59
48.81
24.12
56.77
44.37
63.90
64.67
70.25
86.14
54.40
READ 2016
Hi-SAM
5.34
4.08
6.52
4.74
3.73
8.81
12.39
4.40
8.35
3.57
Table 3: Cross-dataset evaluation of three line detectors trained on four datasets and tested on 9 datasets. Performance is reported as CER%, where lower values indicate better performance.
Tested on
Line Detector
Bentham
NorHand 72702
Riksarkivet BK
Riksarkivet BK 2
Riksarkivet GBG 1
Riksarkivet GBG 2
Zero-shot
Hi-SAM
45.32
54.04
40.64
42.16
44.18
37.08
Few-shot 10
Hi-SAM
64.32
54.64
73.91
71.75
62.77
53.99
Few-shot 50
Hi-SAM
68.10
60.64
75.44
72.81
65.50
59.12
Zero-shot
YOLO
30.44
48.46
51.41
60.40
61.24
50.04
Few-shot 10
YOLO
62.04
57.25
82.14
80.49
67.86
61.02
Table 4: Few-shot mAP% evaluation of Hi-SAM and YOLO line detectors pre-trained on the Mix dataset and fine-tuned on six target datasets. Zero-shot rows report the corresponding results from Table 2 . Higher values indicate better performance.
Tested on
Line Detector
Bentham
NorHand 72702
Riksarkivet BK 1
Riksarkivet BK 2
Riksarkivet GBG 1
Riksarkivet GBG 2
OOD AVG gap with Baseline
Baseline
GT-Boxes
2.22
1.61
3.40
2.48
4.60
2.96
Zero-shot
Hi-SAM
4.44
3.36
4.20
3.14
7.77
11.76
2.90
Few-shot 10
Hi-SAM
3.31
2.72
3.89
2.64
6.59
8.25
1.69
Few-shot 50
Hi-SAM
3.22
2.56
3.57
2.69
6.50
5.89
1.19
Zero-shot
YOLO
5.48
10.81
4.09
3.67
7.53
11.87
4.36
Table 5: Few-shot CER% evaluation of line detectors pre-trained on the Mix dataset and fine-tuned on six OOD datasets. Zero-shot rows report the corresponding results from Table 3 . Lower values indicate better performance. The GT row reports the performance of the HTR model when trained using ground-truth line bounding boxes.
Training
Inference
GPU Memory
# Param.
Training in (GPU) hours
GPU Memory
Model Load Time
Inference per Page Batch Size = 1
A100
Hi-SAM
40 GB
699.2 M (62.2 trainable)
690 GPUh (with SAM weights) 380 GPUh (with Hi-SAM weights)
13 GB
9.75 s
1.6 s
YOLO
26 GB
46.0 M
2.5 GPUh (avg 3100 epochs)
1.5 GB
0.5 s
0.12 s
RT-DETR
23 GB
32.8 M
2.0 GPUh (avg 2500 epochs)
1.2 GB
0.5 s
0.13 s
RTX 4080
Hi-SAM
-
699.2 M (62.2 trainable)
-
-
4.97 s
1.5 s
YOLO
-
46.0 M
50 h (for 3100 epochs)
-
0.10 s
0.11 s
Table 6: Overview of run times of the tested models in different use case environments, investigating the loading time for models as well as training and inference performance.
Practical text-recognition pipelines for historical documents typically decompose layout analysis into line detection followed by a separate reading-order step, with the latter most often handled by a hand-coded geometric heuristic that struggles with marginalia, multiple columns, tables, and source-specific editorial conventions. This article introduces Orli (Ordered Regression of Lines), an end-to-end model that casts both sub-tasks as a single image-to-sequence problem: from a page image, Orli autoregressively generates text-line baselines directly in reading order. Baselines are represented in a chord-frame parameterization that anchors a line's position, orientation, and extent while encoding local geometry through perpendicular offsets; an iterative refinement head and a local visual refiner produce the final curve. Trained on a heterogeneous corpus of 196,691 pages spanning ten writing systems, Orli marginally exceeds the previously reported state of the art for cBAD line detection without dataset-specific training, reaches near perfect coverage and ordering on multiple reading-order benchmarks zero-shot, and adapts to more specialized out-of-domain layouts with limited fine-tuning. The method's source code and model weights are available under an open license at https://github.com/mittagessen/orli.
Despite impressive reported scores, large vision-language models have seen limited practical uptake in historical automatic text recognition because of their computational cost, dependence on large-scale pretraining, and hallucination. Historical ATR therefore continues to rely largely on compact CRNN line recognizers, which are visually grounded and trainable on modest data. Lightweight recurrence-free recognizers promise the accuracy of larger models with the practical advantages of CRNNs, yet have not been comprehensively evaluated on historical writing. We adapt PP-OCRv6, a recent compact text recognizer without strong language modeling, for historical line recognition and compare it with a conventional CRNN across generalized pretraining, domain-specific training, corpus-level fine-tuning, and manuscript-specific few-shot adaptation on multilingual Latin- and Arabic-script material. While PP-OCRv6 does not consistently outperform the baseline when trained from scratch, heterogeneous pretraining produces markedly better generalization. Comparisons with the Qwen3.5-based Medusa recognizer further show that fine-tuned PP-OCRv6 can outperform a large VLM tailored towards historical Latin-script HTR.
Hierarchical text detection aims to localize words, text lines, and paragraphs while parsing their structural relationships. It provides essential structural cues for visual text understanding. To maximize accuracy, existing methods typically rely on complex multi-scale feature fusion necks and heavy-weight heads, resulting in bloated architectures and low inference efficiency. In this paper, we argue that a sufficiently pre-trained backbone can effectively replace these sophisticated external modules, while simple geometric inclusion suffices for hierarchical text structural parsing. Thus, we propose Prism, a minimalist framework for hierarchical text detection. Prism performs multi-granularity detection by attaching parallel lightweight heads to a single-scale backbone feature map, covering words, text lines, and paragraphs, and reconstructs the structural hierarchy via an efficient geometric inclusion algorithm. In addition, we systematically compare representative lightweight head archetypes and show that pixel-level regression offers the best accuracy-efficiency trade-off in this setting. Experiments on multiple public benchmarks show that our significantly simplified architecture achieves state-of-the-art (SOTA) performance with remarkable efficiency. Specifically, it runs 1.7× faster than LRANet on CTW1500 while achieving higher accuracy, and surpasses the current SOTA method, OmniParser V2, by over 6 PQ points on the hierarchical HierText dataset. Code will be released soon.
Yuchen Su, Xuesheng Wang, Zhilong Ji +3
Institute of Trustworthy Embodied AI, Fudan University · Shanghai Key Laboratory of Multimodal Embodied AI · Tomorrow Advancing Life +1