Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,124 @@
|
|
1 |
-
---
|
2 |
-
license: mit
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: mit
|
3 |
+
language: en
|
4 |
+
library_name: ultralytics
|
5 |
+
tags:
|
6 |
+
- yolo
|
7 |
+
- obb
|
8 |
+
- object-detection
|
9 |
+
- document-layout-analysis
|
10 |
+
- digital-humanities
|
11 |
+
- historical-documents
|
12 |
+
- codicology
|
13 |
+
---
|
14 |
+
|
15 |
+
# YOLO-gen 11x-OBB: A Foundational Model for Codicological Layout Analysis
|
16 |
+
|
17 |
+
This repository contains the weights and configuration for **YOLO-gen 11x-OBB**, a generalist object detection model specialized for Document Layout Analysis (DLA) on a wide range of historical manuscripts.
|
18 |
+
|
19 |
+
Unlike models trained on a single corpus, YOLO-gen is the result of a novel data harmonization methodology. It was trained on a unified dataset created by merging three distinct and non-interoperable corpora of historical documents, using a sophisticated hierarchical ontology to reconcile their different annotation schemes.
|
20 |
+
|
21 |
+
This makes YOLO-gen a powerful **foundational model**, intended as a robust starting point for researchers and projects that need to perform layout analysis on diverse collections of Western manuscripts (ca. 12th-17th c.) without training a new model from scratch for each document type.
|
22 |
+
|
23 |
+
The model was developed by Sergio Torres Aguilar at the University of Luxembourg.
|
24 |
+
|
25 |
+
## Model Details
|
26 |
+
|
27 |
+
* **Architecture:** This model uses the **YOLOv11x** architecture with an **Oriented Bounding Box (OBB)** head, making it particularly effective at detecting rotated or non-rectangular layout elements common in manuscripts.
|
28 |
+
* **Ontology:** The model was trained on a hierarchical, multi-label ontology (V7) designed to be both codicologically meaningful and visually coherent. Each object in the training data was tagged with its full path in the hierarchy (e.g., a simple initial was tagged as `Initial`, `Initial_Manuscript`, and `Initial_Ms_Simple`). This provides a rich training signal and enables the model to recognize abstract concepts.
|
29 |
+
* **Parent Classes:** The model can identify high-level conceptual categories, a unique feature not present in specialist models. The main parent classes are: `Text`, `Decoration`, `Initial`, `Marks`, `Damage`, `Numbering`, and the intermediate parent `Paratext`.
|
30 |
+
|
31 |
+
## Intended Uses & Limitations
|
32 |
+
|
33 |
+
### Intended Use
|
34 |
+
|
35 |
+
This model is intended for academic and research use as a strong baseline for Document Layout Analysis on historical manuscripts. It is particularly useful for:
|
36 |
+
* Projects working with diverse collections of manuscripts where training a specialist model for each type is not feasible.
|
37 |
+
* Initializing new DLA projects with a robust, pre-trained detector that understands fundamental codicological structures.
|
38 |
+
* Detecting high-level layout categories (e.g., finding all `Decoration` or all `Initial` elements on a page).
|
39 |
+
|
40 |
+
### Limitations
|
41 |
+
|
42 |
+
* **Performance vs. Specialists:** While highly competitive, this generalist model may be slightly outperformed by a model trained exclusively on a single, specific corpus (e.g., a model trained *only* on the HORAE dataset may be better at detecting HORAE-specific features).
|
43 |
+
* **Recall on Fine-Grained Subclasses:** The model can sometimes be overly cautious, resulting in lower recall for certain specific subclasses (e.g., `Initial_Ms_Simple`).
|
44 |
+
* **Out-of-Domain Performance:** The model was trained on medieval and early modern European manuscripts. Its performance on other domains (e.g., modern documents, non-Latin scripts) is not guaranteed.
|
45 |
+
|
46 |
+
## Training Data
|
47 |
+
|
48 |
+
YOLO-gen was trained on a unified dataset created by merging the following three public corpora. The harmonization was achieved through a custom hierarchical ontology described in the accompanying paper.
|
49 |
+
|
50 |
+
* **e-NDP:** A corpus of Parisian medieval registers (1326-1504) with a relatively homogeneous administrative layout.
|
51 |
+
* **Link:** [https://doi.org/10.5281/zenodo.7575693](https://doi.org/10.5281/zenodo.7575693)
|
52 |
+
* **CATMuS:** A diverse multi-class dataset derived from various medieval and modern sources (ca. 12th-17th c.), including administrative, literary, and printed documents.
|
53 |
+
* **Link:** [https://huggingface.co/datasets/CATMuS/medieval-segmentation](https://huggingface.co/datasets/CATMuS/medieval-segmentation)
|
54 |
+
* **HORAE:** A corpus of richly decorated Books of Hours (ca. 13th-16th c.) with complex and artistic layouts.
|
55 |
+
* **Link:** [https://github.com/oriflamms/HORAE](https://github.com/oriflamms/HORAE)
|
56 |
+
|
57 |
+
## Evaluation
|
58 |
+
|
59 |
+
The model was trained for 120 epochs. The final performance was evaluated on a combined test set containing held-out images from all three source corpora, using standard COCO metrics for Oriented Bounding Boxes.
|
60 |
+
|
61 |
+
### Overall Performance
|
62 |
+
|
63 |
+
| Metric | Value |
|
64 |
+
| :-------------------------- | :---: |
|
65 |
+
| **[email protected]:.95 (all classes)** | **0.558** |
|
66 |
+
| [email protected] (all classes) | 0.740 |
|
67 |
+
| Precision (all classes) | 0.680 |
|
68 |
+
| Recall (all classes) | 0.704 |
|
69 |
+
|
70 |
+
### Performance on Abstract Parent Classes
|
71 |
+
|
72 |
+
A key feature of YOLO-gen is its ability to recognize high-level conceptual classes. The performance on these parent and intermediate classes is as follows:
|
73 |
+
|
74 |
+
| Parent/Intermediate Class | [email protected]:.95 | [email protected] | Precision | Recall |
|
75 |
+
| :----------------------------- | :---------: | :-----: | :-------: | :----: |
|
76 |
+
| Text | 0.675 | 0.861 | 0.749 | 0.861 |
|
77 |
+
| Decoration | 0.629 | 0.839 | 0.712 | 0.902 |
|
78 |
+
| Initial (Universal) | 0.662 | 0.880 | 0.748 | 0.878 |
|
79 |
+
| Marks | 0.665 | 0.821 | 0.643 | 0.900 |
|
80 |
+
| Numbering | 0.422 | 0.776 | 0.611 | 0.820 |
|
81 |
+
| Paratext (Intermediate) | 0.461 | 0.674 | 0.643 | 0.658 |
|
82 |
+
| Initial\_Manuscript (Inter.) | 0.416 | 0.519 | 0.801 | 0.225 |
|
83 |
+
| Initial\_Printed (Inter.) | 0.477 | 0.720 | 0.755 | 0.597 |
|
84 |
+
|
85 |
+
Besides, the model is also able to recognize the original annotations from the 3 above mentioned corpora
|
86 |
+
|
87 |
+
|
88 |
+
## How to Use
|
89 |
+
|
90 |
+
The model can be easily loaded and used with the `ultralytics` Python library.
|
91 |
+
|
92 |
+
```python
|
93 |
+
from ultralytics import YOLO
|
94 |
+
|
95 |
+
# Load the model from the Hugging Face Hub
|
96 |
+
model = YOLO('your_huggingface_username/YOLO-gen-11x-OBB') # Reemplaza con tu usuario/nombre de repo
|
97 |
+
|
98 |
+
# Run inference on an image
|
99 |
+
image_path = 'path/to/your/manuscript_page.jpg'
|
100 |
+
results = model.predict(image_path)
|
101 |
+
|
102 |
+
# Process results
|
103 |
+
# Note: The model performs OBB detection, so results will have xyxyxyxy coordinates.
|
104 |
+
for r in results:
|
105 |
+
for box in r.obb:
|
106 |
+
class_id = int(box.cls)
|
107 |
+
class_name = model.names[class_id]
|
108 |
+
confidence = float(box.conf)
|
109 |
+
coordinates = box.xyxyxyxy.tolist()
|
110 |
+
|
111 |
+
print(f"Detected {class_name} with confidence {confidence:.2f} at {coordinates}")
|
112 |
+
```
|
113 |
+
|
114 |
+
## Citation
|
115 |
+
|
116 |
+
```bibtex
|
117 |
+
@article{torres_aguilar:hal-04983305,
|
118 |
+
title={Benchmarking Object Detectors for Codicological Layout Analysis in Historical Documents},
|
119 |
+
author={Torres Aguilar, Sergio},
|
120 |
+
url={https://hal.science/hal-04983305},
|
121 |
+
year={2025},
|
122 |
+
note = {working paper or preprint}
|
123 |
+
}
|
124 |
+
```
|