Spaces:
Sleeping
Sleeping
Merge pull request #49 from maribakulj/claude/code-quality-audit-ACnhK
Browse files- .github/workflows/sync_to_huggingface.yml +18 -1
- 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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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
|
| 24 |
-
post-correction pipelines on heritage documents.
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
+
|
| 30 |
-
|
| 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.
|
| 45 |
-
|
| 46 |
-
|
| 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 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
|
| 66 |
Heritage-specific metrics (diplomatic CER, ligature and diacritic scores,
|
| 67 |
-
medieval abbreviations, Roman numerals, foliation, fuzzy
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 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 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 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 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 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
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 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 |
|