Marcel Bautista-Kuljevan commited on
Commit
b57ce70
·
unverified ·
2 Parent(s): 64584142cb9762

Merge pull request #49 from maribakulj/claude/code-quality-audit-ACnhK

Browse files
Files changed (2) hide show
  1. .github/workflows/sync_to_huggingface.yml +18 -1
  2. README.md +76 -155
.github/workflows/sync_to_huggingface.yml CHANGED
@@ -18,4 +18,21 @@ jobs:
18
  HF_SPACE: ${{ vars.HF_SPACE || 'Ma-Ri-Ba-Ku/Picarones' }}
19
  run: |
20
  git remote add hf "https://${HF_USERNAME}:${HF_TOKEN}@huggingface.co/spaces/${HF_SPACE}" || true
21
- git push --force hf main
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  HF_SPACE: ${{ vars.HF_SPACE || 'Ma-Ri-Ba-Ku/Picarones' }}
19
  run: |
20
  git remote add hf "https://${HF_USERNAME}:${HF_TOKEN}@huggingface.co/spaces/${HF_SPACE}" || true
21
+ # HuggingFace renvoie régulièrement des 500/503 transitoires sur
22
+ # ses miroirs Git. On retry 5 fois avec backoff linéaire
23
+ # (15s, 30s, 45s, 60s) — total max ~2,5 min, suffisant pour
24
+ # absorber un incident court côté HF.
25
+ attempts=5
26
+ for i in $(seq 1 $attempts); do
27
+ if git push --force hf main; then
28
+ echo "Push HuggingFace réussi (tentative $i/$attempts)"
29
+ exit 0
30
+ fi
31
+ if [ "$i" -lt "$attempts" ]; then
32
+ delay=$((15 * i))
33
+ echo "Tentative $i/$attempts échouée — nouvelle tentative dans ${delay}s..."
34
+ sleep $delay
35
+ fi
36
+ done
37
+ echo "::error::Push HuggingFace échoué après $attempts tentatives (incident HF probable, réessayer plus tard via workflow_dispatch)" >&2
38
+ exit 1
README.md CHANGED
@@ -20,56 +20,34 @@ pinned: false
20
 
21
  ---
22
 
23
- **Picarones** is an open-source benchmarking platform for OCR, HTR, VLM and
24
- post-correction pipelines on heritage documents.
25
-
26
- ### Input contract: pairs of (image, ground truth)
27
-
28
- The user provides a **golden dataset** a folder of pairs `image.{jpg,png,…}`
29
- + ground truth, where the ground truth is plain text (`image.gt.txt`),
30
- **ALTO XML** (`image.xml`), or **PAGE XML** (`image.xml`). The ground truth
31
- must be hand-annotated (or come from a curated reference corpus); Picarones
32
- auto-detects the format and converts ALTO/PAGE to plain text for the
33
- text-level metrics while keeping the structured GT for the ALTO/PAGE/entity
34
- metrics.
35
-
36
- ### Evaluation contract: every metric is computed against the GT in the input pair
37
-
38
- The user plugs in one or several AIs to evaluate — OCR engines, VLMs,
39
- OCR+LLM correction pipelines, alternative re-OCR + LLM + ALTO mappers
40
- chained, etc. Picarones runs each AI on every page of the dataset,
41
- compares the output to the ground truth at every relevant level (text,
42
  ALTO, PAGE, entities, reading order), and produces a self-contained HTML
43
  report with factual numbers, statistical tests and a reproducibility
44
- snapshot. **A benchmark on a corpus without GT is impossible by design**:
45
- Picarones measures how well an AI matches a known annotated reference,
46
- not how well it transcribes an arbitrary document.
47
-
48
- ### Decision contract: the researcher reads the numbers and decides
49
-
50
- This is a **benchmarking platform, not a production workshop**. The
51
- typical workflow is: build a small golden dataset whose script type,
52
- period and language match the production corpus you eventually want to
53
- process; benchmark candidate AIs on that dataset; read the report and
54
- decide which AI is reliable enough to deploy on your real (unlabelled)
55
- production corpus. No prescriptions, no automatic verdicts.
56
-
57
- ### Each researcher brings their own dataset
58
 
59
- Picarones does not yet maintain a curated library of standard golden
60
- datasets. The corpus importers (IIIF, Gallica, HuggingFace, HTR-United,
61
- eScriptorium, ZIP upload) help **fetch and ingest** existing datasets,
62
- but the **choice and curation** are the researcher's responsibility.
63
-
64
- ---
65
 
66
  Heritage-specific metrics (diplomatic CER, ligature and diacritic scores,
67
- medieval abbreviations, Roman numerals, foliation, fuzzy full-text
68
- searchability, philological marker fidelity), composable pipelines, a
69
- **factual narrative synthesis** at the top of the report, **multi-engine
70
- Friedman/Nemenyi significance tests** with a **critical difference
71
- diagram**, **cost / speed / CO₂ Pareto analysis**, **per-junction error
72
- absorption**, **multi-run stability**, **controlled per-slot comparison**.
73
 
74
  > *Version française ci-dessous.*
75
 
@@ -77,35 +55,18 @@ absorption**, **multi-run stability**, **controlled per-slot comparison**.
77
 
78
  ## Use case
79
 
80
- A heritage institution wants to choose an OCR / HTR / post-correction
81
- pipeline to deploy on a future production corpus — say, several thousand
82
- 17th-century parish registers, or 19th-century newspapers, or medieval
83
- glossed manuscripts. They cannot benchmark candidate AIs directly on that
84
- production corpus: there is no ground truth for it, so no metric can be
85
- computed.
86
-
87
- Instead, they assemble (or borrow) a **golden dataset** of a few hundred
88
- hand-annotated pages whose script type, period and language match the
89
- target corpus. Each page is a pair: the image, plus a ground truth in
90
- plain text, ALTO XML, or PAGE XML. They feed the dataset to Picarones and
91
- plug in the AIs to compare:
92
-
93
- - alternative re-OCR (Pero OCR, Kraken, Mistral OCR…);
94
- - LLM correction (GPT-4o, Claude, Mistral) in text-only or image+text mode;
95
- - specialised ALTO mappers (line re-segmentation, abbreviation expansion,
96
- diplomatic normalisation);
97
- - composed pipelines: alternative OCR → LLM correction → ALTO mapper.
98
-
99
- Picarones runs each AI on every page of the golden dataset, compares the
100
- output to the ground truth at every relevant level, measures the metrics
101
- (CER gain, recovered fuzzy searchability, preserved numerical sequences,
102
- **errors introduced by the post-corrector** — critical for LLMs that
103
- silently modernise) and produces a factual HTML report that is **directly
104
- citable in a scientific publication**: every number is traceable to its
105
- source payload, no prescription imposed.
106
-
107
- The researcher reads the numbers and decides which pipeline is reliable
108
- enough to deploy on the actual (unlabelled) production corpus.
109
 
110
  ---
111
 
@@ -115,90 +76,50 @@ enough to deploy on the actual (unlabelled) production corpus.
115
  d'OCR, HTR, VLM et des pipelines de post-correction sur documents
116
  patrimoniaux.
117
 
118
- ### Contrat d'entrée : paires (image, vérité terrain)
119
-
120
- L'utilisateur amène un **golden dataset** un dossier de paires
121
- `image.{jpg,png,…}` + vérité terrain, la VT est en texte brut
122
- (`image.gt.txt`), en **ALTO XML** (`image.xml`), ou en **PAGE XML**
123
- (`image.xml`). La VT doit être annotée à la main (ou provenir d'un corpus
124
- de référence curaté) ; Picarones détecte automatiquement le format et
125
- convertit l'ALTO / PAGE en texte brut pour les métriques textuelles tout
126
- en conservant la VT structurée pour les métriques ALTO / PAGE / entités.
127
-
128
- ### Contrat d'évaluation : chaque métrique est calculée contre la VT de la paire en entrée
129
-
130
- L'utilisateur branche une ou plusieurs IA à évaluer — moteurs OCR, VLM,
131
- pipelines OCR+LLM, ré-OCR alternatif + LLM + mappeur ALTO chaînés, etc.
132
- Picarones exécute chaque IA sur chaque page du dataset, compare la sortie
133
- à la vérité terrain à tous les niveaux pertinents (texte, ALTO, PAGE,
134
- entités, ordre de lecture) et produit un rapport HTML autonome avec
135
- chiffres factuels, tests statistiques et snapshot de reproductibilité.
136
- **Un benchmark sur un corpus sans VT est impossible par design** :
137
- Picarones mesure à quel point une IA matche une référence annotée connue,
138
- pas à quel point elle transcrit un document quelconque.
139
-
140
- ### Contrat de décision : le chercheur lit les chiffres et arbitre
141
-
142
- C'est un **banc d'essai, pas un atelier de production**. Le workflow type
143
- est : constituer un golden dataset de quelques pages annotées dont le
144
- type d'écriture, la période et la langue correspondent au corpus de
145
- production qu'on veut traiter ; benchmarker les IA candidates sur ce
146
- dataset ; lire le rapport et décider quelle IA est assez fiable pour la
147
- passer en prod sur le vrai corpus (non annoté). Pas de prescription, pas
148
- de verdict automatique.
149
-
150
- ### Chaque chercheur amène son propre dataset
151
-
152
- Picarones ne maintient pas (encore) de bibliothèque curatée de golden
153
- datasets standards. Les importers de corpus (IIIF, Gallica, HuggingFace,
154
- HTR-United, eScriptorium, upload ZIP) aident à **récupérer et ingérer**
155
- des datasets existants, mais le **choix et la curation** restent à la
156
- charge du chercheur.
157
-
158
- ---
159
-
160
- Métriques spécifiques aux corpus patrimoniaux (CER diplomatique, scores de
161
- ligatures, abréviations médiévales, numéraux romains, foliotation,
162
- recherchabilité fuzzy plein-texte, fidélité aux marqueurs philologiques),
163
- pipelines composables, **synthèse narrative factuelle** au sommet du rapport,
164
- **tests Friedman/Nemenyi multi-moteurs** avec **diagramme de différence
165
- critique**, analyse **Pareto coût/vitesse/CO₂**, **absorption d'erreur par
166
- jonction**, **stabilité multi-runs**, **comparaison contrôlée par slot**.
167
 
168
  ### Cas d'usage type
169
 
170
- Une institution patrimoniale veut choisir un pipeline OCR / HTR /
171
- post-correction à déployer sur un futur corpus de production — par
172
- exemple plusieurs milliers de registres paroissiaux du XVIIᵉ siècle, ou
173
- de presse du XIXᵉ, ou de manuscrits glosés médiévaux. Elle ne peut pas
174
- benchmarker les IA candidates directement sur ce corpus de production :
175
- il n'y a pas de vérité terrain pour lui, donc aucune métrique ne peut
176
- être calculée.
177
-
178
- À la place, elle constitue (ou récupère) un **golden dataset** de
179
- quelques centaines de pages annotées à la main dont le type d'écriture,
180
- la période et la langue correspondent au corpus cible. Chaque page est
181
- une paire : l'image, plus une vérité terrain en texte brut, ALTO XML, ou
182
- PAGE XML. Elle alimente Picarones avec ce dataset et branche les IA à
183
- comparer :
184
-
185
- - ré-OCR avec un moteur alternatif (Pero OCR, Kraken, Mistral OCR…) ;
186
- - correction LLM (GPT-4o, Claude, Mistral) en mode texte seul ou image+texte ;
187
- - mappeurs ALTO spécialisés (re-segmentation des lignes, fusion des
188
- abréviations, normalisation diplomatique) ;
189
- - pipelines composées : OCR alternatif → correction LLM → mappeur ALTO.
190
-
191
- Picarones exécute chaque IA sur chaque page du golden dataset, compare la
192
- sortie à la vérité terrain à tous les niveaux pertinents, mesure les
193
- métriques (gain CER, recherchabilité fuzzy gagnée, séquences numériques
194
- préservées, **erreurs introduites par le post-correcteur** — critique
195
- pour les LLM qui modernisent silencieusement) et produit un rapport HTML
196
- factuel **directement citable dans une publication scientifique** :
197
- chaque chiffre est traçable au payload source, aucune prescription n'est
198
- imposée.
199
-
200
- Le chercheur lit les chiffres et décide quel pipeline est assez fiable
201
- pour le déployer sur son corpus de production réel (non annoté).
202
 
203
  ---
204
 
 
20
 
21
  ---
22
 
23
+ **Picarones** is an open-source benchmarking platform for OCR, HTR, VLM
24
+ and post-correction pipelines on heritage documents.
25
+
26
+ The input is a folder of `(image, ground truth)` pairs — ground truth in
27
+ plain text (`.gt.txt`), ALTO XML, or PAGE XML, hand-annotated or sourced
28
+ from a reference corpus. Picarones runs the AIs you plug in (OCR engines,
29
+ VLMs, OCR+LLM pipelines, ALTO mappers, ensembles…) on every page,
30
+ compares each output to the ground truth at every relevant level (text,
 
 
 
 
 
 
 
 
 
 
 
31
  ALTO, PAGE, entities, reading order), and produces a self-contained HTML
32
  report with factual numbers, statistical tests and a reproducibility
33
+ snapshot. Without ground truth, no benchmark Picarones measures how
34
+ well an AI matches a known reference, not how well it transcribes an
35
+ arbitrary document.
 
 
 
 
 
 
 
 
 
 
 
36
 
37
+ Typical workflow: assemble a small golden dataset whose profile (script
38
+ type, period, language) matches the production corpus you intend to
39
+ process; benchmark candidate AIs on it; read the report; decide which AI
40
+ to deploy. Picarones does not yet ship a curated library of standard
41
+ datasets — the importers (IIIF, Gallica, HuggingFace, HTR-United,
42
+ eScriptorium, ZIP) help fetch existing data, curation remains yours.
43
 
44
  Heritage-specific metrics (diplomatic CER, ligature and diacritic scores,
45
+ medieval abbreviations, Roman numerals, foliation, fuzzy searchability,
46
+ philological marker fidelity), composable pipelines, factual narrative
47
+ synthesis at the top of the report, multi-engine Friedman/Nemenyi tests
48
+ with critical difference diagram, cost / speed / CO₂ Pareto analysis,
49
+ per-junction error absorption, multi-run stability, controlled per-slot
50
+ comparison.
51
 
52
  > *Version française ci-dessous.*
53
 
 
55
 
56
  ## Use case
57
 
58
+ An archive, a digital library or a heritage service plans to OCR a
59
+ production corpus — say, several thousand 17th-century parish registers,
60
+ 19th-century newspapers, or medieval glossed manuscripts. Several
61
+ candidate pipelines are on the table (alternative OCR, LLM correction,
62
+ ALTO mappers, ensembles); the question is which one to deploy.
63
+
64
+ The candidates cannot be benchmarked on the production corpus itself
65
+ (no ground truth). A small golden dataset matching the target profile is
66
+ assembled; Picarones runs each candidate on it and reports CER gain,
67
+ recovered fuzzy searchability, preserved numerical sequences, errors
68
+ introduced by post-correctors and statistical significance. The numbers
69
+ inform the deployment decision.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
 
71
  ---
72
 
 
76
  d'OCR, HTR, VLM et des pipelines de post-correction sur documents
77
  patrimoniaux.
78
 
79
+ L'entrée est un dossier de paires `(image, vérité terrain)` — VT en
80
+ texte brut (`.gt.txt`), ALTO XML, ou PAGE XML, annotée à la main ou
81
+ issue d'un corpus de référence. Picarones exécute les IA que vous
82
+ branchez (moteurs OCR, VLM, pipelines OCR+LLM, mappeurs ALTO,
83
+ ensembles…) sur chaque page, compare la sortie à la VT à tous les
84
+ niveaux pertinents (texte, ALTO, PAGE, entités, ordre de lecture) et
85
+ produit un rapport HTML autonome avec chiffres factuels, tests
86
+ statistiques et snapshot de reproductibilité. Sans vérité terrain, pas
87
+ de benchmark Picarones mesure à quel point une IA matche une référence
88
+ connue, pas à quel point elle transcrit un document quelconque.
89
+
90
+ Workflow type : constituer un golden dataset dont le profil (type
91
+ d'écriture, période, langue) correspond au corpus de production à
92
+ traiter ; benchmarker les IA candidates dessus ; lire le rapport ;
93
+ décider quelle IA déployer. Picarones ne fournit pas encore de
94
+ bibliothèque curatée de datasets standards les importers (IIIF,
95
+ Gallica, HuggingFace, HTR-United, eScriptorium, ZIP) aident à récupérer
96
+ des données existantes, la curation reste à votre charge.
97
+
98
+ Métriques spécifiques aux corpus patrimoniaux (CER diplomatique, scores
99
+ de ligatures et diacritiques, abréviations médiévales, numéraux romains,
100
+ foliotation, recherchabilité fuzzy, fidélité aux marqueurs
101
+ philologiques), pipelines composables, synthèse narrative factuelle au
102
+ sommet du rapport, tests Friedman/Nemenyi multi-moteurs avec diagramme
103
+ de différence critique, analyse Pareto coût/vitesse/CO₂, absorption
104
+ d'erreur par jonction, stabilité multi-runs, comparaison contrôlée par
105
+ slot.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
 
107
  ### Cas d'usage type
108
 
109
+ Une archive, une bibliothèque numérique ou un service patrimonial
110
+ prévoit d'OCRiser un corpus de production — par exemple plusieurs
111
+ milliers de registres paroissiaux du XVIIᵉ, de presse du XIXᵉ ou de
112
+ manuscrits glosés médiévaux. Plusieurs pipelines candidats sont sur la
113
+ table (OCR alternatif, correction LLM, mappeurs ALTO, ensembles) ;
114
+ reste à décider lequel déployer.
115
+
116
+ Les candidats ne peuvent pas être benchmarkés sur le corpus de
117
+ production lui-même (pas de VT). On constitue un golden dataset
118
+ matching le profil cible ; Picarones exécute chaque candidat dessus et
119
+ remonte le gain CER, la recherchabilité fuzzy gagnée, les séquences
120
+ numériques préservées, les erreurs introduites par les post-correcteurs
121
+ et la significativité statistique. Les chiffres nourrissent la décision
122
+ de déploiement.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
 
124
  ---
125