Datasets:
ArXiv:
License:
Jules Musquin commited on
Commit ·
eb571e0
1
Parent(s): 1b49cbc
[ADD] ajout des fichiers de bases
Browse files- README.md +88 -3
- classes.txt +5 -0
- renommage.csv +0 -0
- visualisation.py +80 -0
README.md
CHANGED
|
@@ -1,3 +1,88 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# GenHisDoc
|
| 2 |
+
|
| 3 |
+
GenHisDoc is a generalistic datasets for historical documents layout recognition and detection. GenHisDoc use a combination of several previously published datasets which have been adapted and re-annotated to work together and our own annotated data.
|
| 4 |
+
|
| 5 |
+
```markdown
|
| 6 |
+
GenHisDoc
|
| 7 |
+
├── images
|
| 8 |
+
├── labels
|
| 9 |
+
└── classes.txt
|
| 10 |
+
```
|
| 11 |
+
|
| 12 |
+
## Published Datasets inside GenHisDoc
|
| 13 |
+
|
| 14 |
+
### The Sacrobosco Dataset (S-VED)
|
| 15 |
+
Paper : [CorDeep and the Sacrobosco Dataset: Detection of Visual Elements in Historical Documents](https://doi.org/10.3390/jimaging8100285)
|
| 16 |
+
|
| 17 |
+
Published by Jochen Büttner 1, Julius Martinetz 1,2, Hassan El-Hajj 1,2, Matteo Valleriani 1,2,3,4.
|
| 18 |
+
|
| 19 |
+
1 : Max Planck Institute for the History of Science, Boltzmannstr. 22, 14195 Berlin, Germany
|
| 20 |
+
|
| 21 |
+
2 : BIFOLD—Berlin Institute for the Foundations of Learning and Data, 10587 Berlin, Germany
|
| 22 |
+
|
| 23 |
+
3 : Institute of History and Philosophy of Science, Technology, and Literature, Faculty I—Humanities and Educational Sciences, Technische Universität Berlin, Straße des 17. Juni 135, 10623 Berlin, Germany
|
| 24 |
+
|
| 25 |
+
4 : The Cohn Institute for the History and Philosophy of Science and Ideas, Faculty of Humanities, Tel Aviv University, P.O. Box 39040, Ramat Aviv, Tel Aviv 6139001, Israel
|
| 26 |
+
|
| 27 |
+
Datasets : [The Sacrobosco Dataset](https://zenodo.org/record/7142456)
|
| 28 |
+
|
| 29 |
+
Modifications : The printer's mark annotation classe has been transfered to the illustration annotation classe. The format of the annotation in csv as been transformed into yolo style format with a txt attached to the image.
|
| 30 |
+
|
| 31 |
+
### IlluHisDoc
|
| 32 |
+
|
| 33 |
+
Paper : [docExtractor: An off-the-shelf historical document element extraction](https://arxiv.org/abs/2012.08191)
|
| 34 |
+
|
| 35 |
+
Published by Tom Monnier 1 et Mathieu Aubry 1
|
| 36 |
+
|
| 37 |
+
1 : LIGM, École nationale des Ponts et chaussées, Université Gustave Eiffel, CNRS, Marne-la-vallée, France
|
| 38 |
+
|
| 39 |
+
Datasets: [Illuhisdoc dropbox link](https://www.dropbox.com/scl/fi/ql0yxqapyyl0adbzzgn1x/illuhisdoc.zip?rlkey=q7mqkd3ljzwrk3lelkm2rgico&e=1&dl=0)
|
| 40 |
+
|
| 41 |
+
Modifications : Illuhisdoc use a per pixel segmentation with 4 classes, we transformed this segmentation in yolo style format detection.
|
| 42 |
+
|
| 43 |
+
### Horae LSv2
|
| 44 |
+
|
| 45 |
+
Datasets : [HORAE-LSv2. Layout Segmentation Dataset for Medieval Books of Hours (Version 2)](https://zenodo.org/records/16919911)
|
| 46 |
+
|
| 47 |
+
Published by Stutzmann Dominique 1, Bernard Leterme Lise 1, Boillet Mélodie 2, Bonhomme Marie-Laurence, Kermorvant Christopher 3
|
| 48 |
+
|
| 49 |
+
1 : Institut de recherche et d'histoire des textes du Centre national de la recherche scientifique, Paris - Aubervilliers, 14, cours des Humanités, 93322 Aubervilliers
|
| 50 |
+
|
| 51 |
+
2 & 3 : Teklia, 30 rue Raymond Losserand, 75014 Paris, France
|
| 52 |
+
|
| 53 |
+
Modificatons : Horae use a deep annotation system usefull only for manuscript, we reunited this classes into our segmentation ontology. We kept 4244 annotations about ornements, illustrations and initials, and suppressed 18720 annotations about text segmentation.
|
| 54 |
+
|
| 55 |
+
### Newspaper Navigator
|
| 56 |
+
|
| 57 |
+
Dataset : []()
|
| 58 |
+
|
| 59 |
+
## Unpublished Datasets inside GenHisDoc
|
| 60 |
+
|
| 61 |
+
### Aikon / Projet VHS / Eida
|
| 62 |
+
|
| 63 |
+
[Aikon](https://aikon-platform.github.io/) is a IIIF automatic annotation project financed by the ERC project DISCOVER and developped between the [IMAGINE-LIGM laboratory at École nationale des ponts et chaussées](https://imagine-lab.enpc.fr/), [LTE laboratory at Observatoire de Paris-PSL](https://lte.observatoiredeparis.psl.eu/). Aikon is not a dataset, we aggregated and formated the open and human corrected annotated witness by the community in the Project VHS and Eida environnement of Aikon.
|
| 64 |
+
|
| 65 |
+
#### Projet VHS
|
| 66 |
+
|
| 67 |
+
[VHS](https://vhs.hypotheses.org/) is an interdisciplinary research project bringing together specialists in History of Science and Computer Vision to develop a new approach in the historical analysis of the circulation of scientific knowledge and the development of a visual scientific thought from the Middle Ages to the modern era, based on new methods of illustration analysis.
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
Witness #2320 : Cyclopaedia, 5e éd., Vol. 2 - annotated by Alexandre
|
| 72 |
+
|
| 73 |
+
Witness #2365 : Latin 7416 | Paris, BnF - annotated by Alexandre
|
| 74 |
+
|
| 75 |
+
Witness #2377 : Cod. 44 | Österreichische Nationalbibliothek - annotated by Alexandre
|
| 76 |
+
|
| 77 |
+
Witness #2416 : Lat. Q. 9 | Universiteitsbibliotheek - annotated by Alexandre
|
| 78 |
+
|
| 79 |
+
Witness #2418 : Voss. Lat. Q. 40 | Universiteitsbibliotheek - annotated by Alexandre
|
| 80 |
+
|
| 81 |
+
Witness #2420 : 187 | Wien, Österreichische Nationalbibliothek - annotated by Alexandre
|
| 82 |
+
|
| 83 |
+
Witness #2421 : T. 47 | Biblioteca Ambrosiana - annotated by Alexandre
|
| 84 |
+
|
| 85 |
+
Witness #2387 : Latin 13955 | Paris, BnF - annotated by Alexandre
|
| 86 |
+
|
| 87 |
+
Witness #2423 : Dc 183 | Dresden, Sächsische Landesbibliothek - annotated by Alexandre
|
| 88 |
+
|
classes.txt
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Illustration
|
| 2 |
+
Initial
|
| 3 |
+
Ornament
|
| 4 |
+
Stamp
|
| 5 |
+
Table
|
renommage.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
visualisation.py
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pathlib import Path
|
| 2 |
+
from PIL import Image, ImageDraw, ImageFont
|
| 3 |
+
from tqdm import tqdm
|
| 4 |
+
import random
|
| 5 |
+
import os
|
| 6 |
+
import numpy as np
|
| 7 |
+
from ultralytics.utils.plotting import Annotator, colors
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def draw_yolo_annotations(image_path: Path, label_path: Path, label_map: dict) -> Image.Image | None:
|
| 11 |
+
"""Dessine les bounding boxes YOLO sur l'image et retourne une PIL Image."""
|
| 12 |
+
if not image_path.exists():
|
| 13 |
+
print(f"Image introuvable : {image_path}")
|
| 14 |
+
return None
|
| 15 |
+
if not label_path.exists():
|
| 16 |
+
print(f"Label introuvable : {label_path}")
|
| 17 |
+
return None
|
| 18 |
+
img = np.array(Image.open(image_path).convert("RGB"))
|
| 19 |
+
h, w = img.shape[:2]
|
| 20 |
+
annotator = Annotator(img, line_width=2)
|
| 21 |
+
with open(label_path, "r") as f:
|
| 22 |
+
for line in f:
|
| 23 |
+
parts = line.strip().split()
|
| 24 |
+
if len(parts) < 5:
|
| 25 |
+
continue
|
| 26 |
+
cls_id = int(parts[0])
|
| 27 |
+
cx, cy, bw, bh = map(float, parts[1:5])
|
| 28 |
+
# Conversion YOLO (normalisé) → pixels (x1, y1, x2, y2)
|
| 29 |
+
x1 = int((cx - bw / 2) * w)
|
| 30 |
+
y1 = int((cy - bh / 2) * h)
|
| 31 |
+
x2 = int((cx + bw / 2) * w)
|
| 32 |
+
y2 = int((cy + bh / 2) * h)
|
| 33 |
+
label = label_map.get(cls_id, str(cls_id))
|
| 34 |
+
annotator.box_label([x1, y1, x2, y2], label=label, color=colors(cls_id, True))
|
| 35 |
+
|
| 36 |
+
result = annotator.result()
|
| 37 |
+
return Image.fromarray(result)
|
| 38 |
+
|
| 39 |
+
def controle():
|
| 40 |
+
|
| 41 |
+
label_map = {
|
| 42 |
+
0: "Illustration",
|
| 43 |
+
1: "Ornament",
|
| 44 |
+
2: "Initial",
|
| 45 |
+
3: "Stamp",
|
| 46 |
+
4: "Table",
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
images_dir = Path("images")
|
| 50 |
+
labels_dir = Path("labels")
|
| 51 |
+
|
| 52 |
+
identifier_list = []
|
| 53 |
+
annotations_crées = 0
|
| 54 |
+
annotations_ignorées = 0
|
| 55 |
+
|
| 56 |
+
print("génération des annotations")
|
| 57 |
+
|
| 58 |
+
for filename in tqdm(os.listdir(labels_dir)):
|
| 59 |
+
if not filename.endswith(".txt"):
|
| 60 |
+
continue
|
| 61 |
+
identifier = filename.replace(".txt", "")
|
| 62 |
+
output_path = Path(f'annotations/{identifier}.jpg')
|
| 63 |
+
|
| 64 |
+
image = draw_yolo_annotations(
|
| 65 |
+
images_dir / f'{identifier}.jpg',
|
| 66 |
+
labels_dir / f'{identifier}.txt',
|
| 67 |
+
label_map,
|
| 68 |
+
)
|
| 69 |
+
|
| 70 |
+
if image is None:
|
| 71 |
+
annotations_ignorées += 1
|
| 72 |
+
continue # on passe à l'image suivante
|
| 73 |
+
|
| 74 |
+
if not output_path.is_file():
|
| 75 |
+
image.save(output_path)
|
| 76 |
+
annotations_crées += 1
|
| 77 |
+
else:
|
| 78 |
+
annotations_ignorées += 1
|
| 79 |
+
|
| 80 |
+
controle()
|