Image Classification
timm
Safetensors

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

import timm, torch
from PIL import Image

model = timm.create_model(
    "hf-hub:davanstrien/britannica-illustrated-detector", pretrained=True
).eval()
data_cfg = timm.data.resolve_model_data_config(model)
tfm = timm.data.create_transform(**data_cfg, is_training=False)

probs = torch.softmax(model(tfm(Image.open("page.jpg").convert("RGB")).unsqueeze(0)), dim=-1)[0]
is_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.

Downloads last month
21
Safetensors
Model size
7.52M params
Tensor type
F32
Β·
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Dataset used to train davanstrien/britannica-illustrated-detector