Britannica illustrated-page detector (efficientvit_b1.r256_in1k)
Classifies scans of historical encyclopedia pages as illustrated (1) or not illustrated (0).
Built as a fast, cheap replacement for a 2023 AutoTrain ViT-B/16@384 classifier, for
pre-filtering and confirming illustration candidates across large scanned-book collections
(e.g. the ~4 TB Internet Archive mirror of Encyclopaedia Britannica editions).
Usage
1import timm, torch
2from PIL import Image
3
4model = timm.create_model(
5 "hf-hub:davanstrien/britannica-illustrated-detector", pretrained=True
6).eval()
7data_cfg = timm.data.resolve_model_data_config(model)
8tfm = timm.data.create_transform(**data_cfg, is_training=False)
9
10probs = torch.softmax(model(tfm(Image.open("page.jpg").convert("RGB")).unsqueeze(0)), dim=-1)[0]
11is_illustrated = probs[1].item() >= 0.982 # recommended threshold
Label mapping: index 0 = not illustrated, index 1 = illustrated (dataset ground-truth order).
- Recommended threshold: 0.982 on P(illustrated) — the best-F1 point on the held-out NLS split.
- Out-of-domain validation (2026-08-19, human-labelled): on 72 pages sampled from the Internet Archive Britannica mirror (different editions, scanners and OCR quality than the NLS training data), the model scored precision 1.000 / recall 0.872 at 0.982 — every miss was a near-threshold page at 0.91–0.98. For mirror-style harvesting, use threshold 0.90 (F1 1.0 on the labelled sample; negatives max 0.878, positives min 0.913).
- Input: 256×256, RGB (grayscale scans are replicated to 3 channels by the transform).
Results (same held-out split: 515 pages, 24 illustrated, seed 42)
| model | params | input | PR-AUC | best-F1 (swept thr) | acc @ thr | confusion (TN/FP/FN/TP) |
|---|
| AutoTrain ViT-B/16 (baseline) | 86 M | 384² | 1.000 | 1.000 @ 0.941 | 1.000 | 491 / 0 / 0 / 24 |
| timm mobilenetv4_conv_medium (e500_r256_in1k) | 8.4 M | 256² | 0.961 | 0.933 @ 1.000 | 0.994 | 491 / 0 / 3 / 21 |
| timm efficientvit_b1.r256_in1k (this model) | 7.5 M | 256² | 1.000 | 1.000 @ 0.982 | 1.000 | 491 / 0 / 0 / 24 |
Honest caveats:
- Both the baseline and this model saturate the split (perfect ranking of all 24 positives).
At this validation scale the two models cannot be distinguished on quality — the case for
this model is equal measured quality at ~11× fewer parameters and 9–37× cheaper inference
(384²→256² input, 86M→7.5M params), not superiority.
- The baseline was trained in 2023 on the same NLS dataset via AutoTrain with an unknown
split, so its rows above may be mildly optimistic (possible train/eval overlap from its
original split); this model's split (seed 42, stratified 80/20) is disjoint from its own training data by construction.
Training
- Data:
NationalLibraryOfScotland/encyclopaedia_britannica_illustrated
(2,573 pages; 2,451 not-illustrated / 122 illustrated). CC0. Read directly from parquet (pyarrow).
- Recipe:
timm.create_model(..., pretrained=True, num_classes=2), 12 epochs, batch 64,
AdamW 3e-4 (cosine, ~3% warmup, wd 0.05), class-weighted cross-entropy with
sqrt inverse-frequency weights (≈[0.22, 4.47]) for the 20:1 class imbalance.
- Augmentation (light — book pages have a canonical orientation): RandomResizedCrop 256
(scale 0.65–1.0), rotation ≤5°, brightness/contrast jitter 0.2; no flips.
- Split: stratified 80/20, seed 42. Epoch-12 checkpoint selected on val PR-AUC.
- Trained on HF Jobs (a10g-small, ~5 min wall-clock).
Deployed at scale
This model was run over
every page of all ~1,219 scanned volumes of the Britannica mirror
(~1,007,000 pages): 117,390 illustrated pages were extracted and published (with full
page-level scores) in
davanstrien/britannica-illustrated-pages.
Production thresholds (validated on 347 human-labelled pages across two independent samples):
0.90 for text-dense pages, 0.982 for low-text pages.
Intended use
Pre-filter / confirmation step for finding illustrated pages in historical encyclopedia and
similar scanned-book collections (where "few words in djvu.xml" is a cheap first-stage
signal and this model is the second stage). Not intended as a general illustration detector
for non-page documents, modern books, or colour photography; validate the threshold on a
sample of your own collection before bulk use.
Replaces
This model replaces
davanstrien/autotrain-encyclopaedia-illustrations-blog-post-3327992158
— same task, 9–37× cheaper inference (metrics in the table above; lineage auditable via the
matching metrics.json in the training repo).
⚠️ Migration note: that baseline's config.json id2label ("0": "illustrated") is
inverted relative to the dataset convention used here. Statistical orientation checking
on 515 held-out pages shows its logits actually follow the dataset convention
(PR-AUC 1.000 as-read vs 0.025 if you trust its id2label). If you are migrating, keep the
raw class indices and re-map explicitly — do not consume the old config's label names.