Herculaneum Legibility Proxy v5
Where in the ink maps is there readable text? A small ResNet-18 that looks at a ~1 cm window of a Vesuvius Challenge ink-probability map and scores how much it looks like connected Greek letterforms rather than fiber texture, noise or damage.
| What it does | Ranks ink-map windows by "legible-text likelihood" so a human knows where to look first |
| What it is not | Not an ink detector, not a text reader. It does not detect, localize, segment, recognize or transcribe letters |
| Input | One grayscale crop of an ink map covering ~1 cm of papyrus |
| Output | An uncalibrated ranking score in [0, 1] (higher = more letterform-like), plus the logit |
| Architecture | torchvision ResNet-18, ImageNet V1 init, fc β 1 |
| Training data | 2,836 labeled windows from 5 scrolls β herculaneum-legibility-proxy-labels-v5 |
| Previous version | proxy_v4 (archived, same architecture and preprocessing) |
| Frozen research revision | 869b216c (exact historical record of this package) |
What it is for
The community's ink-detection models already tell us where the ink is. This model answers the next question: of all that detected ink, where is there text worth a human's time? It runs downstream of the ink detectors, on their output maps, and is meant for triage: sort thousands of windows, review the top of the list by eye.
Use it to:
- rank windows within one ink map, or within one family of maps rendered by the same ink model;
- pick candidate regions for human review or for labeling;
- compare its ranking against proxy_v4 on your own maps.
Do not use it to:
- decide that a region has no text and discard it (there is no validated rejection threshold);
- compare raw scores across different ink models or render families;
- claim that letters were read or identified.
How to use
git clone https://huggingface.co/LimeGS/herculaneum-legibility-proxy-v5
cd herculaneum-legibility-proxy-v5
python3 -m venv .venv && . .venv/bin/activate
# CPU only (skips the multi-GB CUDA build of torch on Linux):
python3 -m pip install --index-url https://download.pytorch.org/whl/cpu torch==2.12.1 torchvision==0.27.1
python3 -m pip install -r requirements.txt
python3 score.py --checkpoint final.pt --metadata model_metadata.json --image /path/to/crop.png
Skip the CPU-only line to get the default torch build (with CUDA on Linux).
score.py checks the checkpoint's SHA-256 before loading it, applies the
canonical stretch160 preprocessing from preprocess.py (percentile stretch
over active pixels, bilinear resize to 160Γ160) and prints one JSON line with
score, logit, quality_status, checkpoint_sha256, recipe_id,
candidate_arm, seed, schema_version, score_semantics and a scope
note.
Getting the window right. The window must cover ~1 cm of papyrus, whatever the map's pixel size. Compute it from the segment's real physical scale and never assume a fixed pixel count. Scores do not transfer across ink-model render families: rank within one family only. Both rules come from the proxy_v4 card, which explains them in detail, and apply unchanged here.
Scan a whole map
scan_map.py applies the window rule for you. It takes one ink-map image and
its pixel size, cuts it into ~1 cm windows and writes every window's score to a
CSV, best first:
python3 scan_map.py --image /path/to/ink_map.png --um-per-px 7.91 --out scores.csv
- Window size is
round(9830 / um_per_px)pixels, about 1 cm of papyrus (the proxy_v4 training scale).--um-per-pxis required: use the map's real physical pixel size. At 7.91 Β΅m/px a window is 1,243 px. - Stride defaults to half a window. Change it with
--stride <pixels>. - Windows that do not fit fully inside the map are skipped, never
stretched. Near-empty windows (50 or fewer pixels brighter than 10, the same
active-pixel rule as
preprocess.py) are skipped too. - Every window is scored with
score.py's own checkpoint verification and metadata check,preprocess.py's preprocessing, and the same model setup. A window cut exactly at a crop gives the same score asscore.pyon that crop. This was checked on a mosaic of dataset crops: max logit difference 5e-7 at--batch-size 1, 8e-7 at the default batch of 64. --device cudaruns on a GPU, and--batch-size(default 64) sets the batch.--top Nsets how many rows the printed summary shows (default 10). Very large images are allowed (PIL's pixel limit is off).- CSV columns are
x, y, width, height, score, logit, withx, ythe window's top-left corner in map pixels. Scores are uncalibrated ranking scores: compare them within one map, or within one render family.
How it was made
- Cohort. 2,836 windows (2,198 legible / 638 not): 2,406 historical labels after a September 2026 correction of the voting policy, plus 430 training-only additions (404 provisional majority votes and 26 historical consensus labels). Labels are about legibility, not ink presence.
- Evaluation design. Leave-one-scroll-out over five scrolls, three seeds, 45 fits in total. Before training, one arm (R2B: corrected labels + additions + per-scroll/class balancing) was declared the candidate, with an acceptance rule: beat R1 (corrected labels only) by β₯ +0.01 macro AUROC and lose no more than 0.03 on any scroll.
- Final model. R2B refit from ImageNet on all 2,836 windows, seed 0, 356 optimizer steps (fixed before the refit from the cross-validation step budget).
Results
Macro AUROC over the four scrolls where AUROC is defined, mean of three seeds,
leave-one-scroll-out (from the dataset's evidence/REPORT.md):
| Model | Macro AUROC |
|---|---|
| proxy_v4 (archived reference) | 0.756 |
| R1: corrected labels only | 0.860 |
| R2: R1 + 430 additions | 0.832 |
| R2B: R2 + balancing (this checkpoint's recipe) | 0.810 |
Per held-out scroll (AUROC, mean of three seeds):
| Held-out scroll | Test windows | proxy_v4 | R1 | R2B |
|---|---|---|---|---|
| PHerc. 0139 | 195 | 0.640 | 0.830 | 0.809 |
| PHerc. 0814 | 61 | 0.580 | 0.775 | 0.603 |
| PHerc. 1667 | 147 | 0.953 | 0.977 | 0.985 |
| PHerc. Paris. 4 | 1,984 | 0.851 | 0.858 | 0.844 |
| PHerc. 0172 | 19 | only negatives, AUROC undefined |
What this means:
- R2B scores higher than proxy_v4 (+0.055 macro AUROC) on this historical benchmark. That comparison is retrospective: proxy_v4 was trained on PHerc. Paris. 4, and its independence on the other scrolls is not established.
- R2B did not meet its predeclared acceptance rule against R1: it came out β0.049 below R1, and β0.172 below R1 on PHerc. 0814. The candidate and seed were fixed before the test was looked at and were not changed afterwards.
- R1 was the strongest recipe. It remains a hypothesis to confirm on new, independent data.
Limits
- The final all-data refit has no held-out evaluation of its own.
- Scores are uncalibrated ranking scores, not probabilities.
- Scope is
historical_unharmonized_diagnostic: no physically transported masks, no certified crop/raster/geometry correspondence, no territorial groups (physical_groupis unknown for every row), no new independent human review. - Historical metrics were measured with CUDA BF16 channels-last; this portable scorer runs CPU FP32, so small numerical differences are possible.
Files
| File | What it is | SHA-256 (first 12) |
|---|---|---|
final.pt |
R2B refit, seed 0, ResNet-18 state dict (44.8 MB) | 7179f40882a7 |
score.py |
portable scorer, verifies the checkpoint hash before loading | 2eeeb9d25f89 |
preprocess.py |
canonical stretch160 preprocessing |
f7707b662a7d |
scan_map.py |
scans a whole ink map in ~1 cm windows and writes a ranked CSV (uses score.py and preprocess.py) |
β |
model_metadata.json |
machine-readable status, hashes, acceptance-gate result, limits | β |
requirements.txt |
dependencies (Pillow as a range) | β |
model_metadata.json is kept byte-identical to the frozen research revision.
The README.md hash inside it refers to the exporter's original card, not to
this one.
Related
- Training data, splits, raw crops, full code and the evaluation report: LimeGS/herculaneum-legibility-proxy-labels-v5
- Previous model: LimeGS/herculaneum-legibility-proxy (proxy_v4) and its data: LimeGS/herculaneum-legibility-proxy-labels
License
Code (score.py, preprocess.py, scan_map.py): MIT, see
LICENSE-CODE. Model weights (final.pt) and metadata:
CC BY-NC 4.0, see LICENSE, matching the Vesuvius Challenge data
they derive from. Trained only on publicly released Vesuvius Challenge ink-map
data and the project's own historical labels.