davanstrien HF Staff commited on
Commit
24cb9a9
Β·
verified Β·
1 Parent(s): 43b0869

Add live Space link, clean r3_test accuracy (96.3%), and CC-MAIN-2026-47 bulk receipt

Browse files
Files changed (1) hide show
  1. README.md +12 -1
README.md CHANGED
@@ -58,7 +58,8 @@ A fast, compact image model that looks at a document page and predicts which wri
58
 
59
  Built on **MobileNetV4-conv-small** (2.52M parameters, 10.1 MB as ONNX or `timm` weights), distilled from a 3-family teacher ensemble (`convnext_small`, `hgnetv2_b4`, `caformer_s36`) on [Hugging Face Jobs](https://huggingface.co/docs/hub/jobs). Takes a greyscale page squashed to `640 Γ— 640` and runs in **33 ms** on 1 CPU thread, **11 ms** on 4 threads, or **1,773 pages/s** on an A10G (`bf16`, batch 64).
60
 
61
- Need higher accuracy on heavily photographed documents or scans and can spare ~2.4Γ— CPU time? See the sibling model **[`davanstrien/page-script-id-v2-hgnet`](https://huggingface.co/davanstrien/page-script-id-v2-hgnet)** (HGNetV2-B0, 3.99M parameters, 16 MB, 79 ms 1t / 36 ms 4t, 88.0% MDPBench photographed).
 
62
 
63
  > **Check the thresholds on your own pages.** The default cut-offs (`0.55` for a script, `0.7038` for `unknown`) were chosen on held-out web-PDF validation pages (95% coverage). On government documents this refuses ~8% and on photographed documents ~28%. Run on a few hundred of your own pages and tune `unknown_threshold` and `script_threshold` in `config.json` before bulk routing.
64
 
@@ -128,6 +129,7 @@ All test benchmarks are strictly held out from training (never trained on test d
128
  | Web PDFs (`r2_test`), text layer | text layer | 2,056 | **94.0%** | 93.9–94.0% | 94.1% |
129
  | Web PDFs (`r2_test`), doc label | doc language | 2,695 | **94.3%** | 93.5–94.3% | 94.4% |
130
  | Government docs (`r3_test`, 21 scripts) | text layer / scan doc | 2,140 | **86.8%** | 86.8–86.9% | 87.6% |
 
131
  | β€” `r3_test` scans subset | scan doc label | 789 | **90.1%** | 89.1–90.1% | 90.9% |
132
  | [MDPBench](https://huggingface.co/datasets/Delores-Lin/MDPBench), digital | benchmark lang | 680 | **95.6%** | 94.7–95.6% | 96.3% |
133
  | β€” digital Japanese (`jp`) / Russian (`ru`) | benchmark lang | 40 / 40 | **85.0% / 90.0%** | 85–88% / 80–90% | 82.5% / 82.5% |
@@ -167,6 +169,15 @@ Measured on a cloud `a10g-large` box (12 vCPU, 1Γ— A10G), model forward only on
167
 
168
  **ONNX ↔ PyTorch parity** (400 `r2_val` pages): `max |prob diff| = 2.0e-6`, **100.0% top-1 agreement**. Post-training INT8 quantization (both static QDQ and dynamic) was tested and **not shipped**: on MobileNetV4 depthwise convolutions, PTQ degraded agreement to 63.8% (static) / 6.5% (dynamic) without improving 1-thread CPU latency.
169
 
 
 
 
 
 
 
 
 
 
170
  ## Limits
171
 
172
  1. **Unseen scripts & look-alikes:** not an unseen-script detector. Unseen scripts that visually resemble trained scripts (e.g. Gurmukhi β†’ Devanagari, Sinhala β†’ Kannada/Telugu) or appear alongside secondary Latin headers are often accepted with moderate-to-high confidence.
 
58
 
59
  Built on **MobileNetV4-conv-small** (2.52M parameters, 10.1 MB as ONNX or `timm` weights), distilled from a 3-family teacher ensemble (`convnext_small`, `hgnetv2_b4`, `caformer_s36`) on [Hugging Face Jobs](https://huggingface.co/docs/hub/jobs). Takes a greyscale page squashed to `640 Γ— 640` and runs in **33 ms** on 1 CPU thread, **11 ms** on 4 threads, or **1,773 pages/s** on an A10G (`bf16`, batch 64).
60
 
61
+ - **Try it live:** [Page Script ID Demo Space](https://huggingface.co/spaces/davanstrien/page-script-id-demo) (runs on free CPU β€” upload images or PDFs, toggle crop padding, tune thresholds live)
62
+ - **Higher-accuracy sibling:** [`davanstrien/page-script-id-v2-hgnet`](https://huggingface.co/davanstrien/page-script-id-v2-hgnet) (HGNetV2-B0, 3.99M parameters, 16 MB, 79 ms 1t / 36 ms 4t, 88.0% MDPBench photographed)
63
 
64
  > **Check the thresholds on your own pages.** The default cut-offs (`0.55` for a script, `0.7038` for `unknown`) were chosen on held-out web-PDF validation pages (95% coverage). On government documents this refuses ~8% and on photographed documents ~28%. Run on a few hundred of your own pages and tune `unknown_threshold` and `script_threshold` in `config.json` before bulk routing.
65
 
 
129
  | Web PDFs (`r2_test`), text layer | text layer | 2,056 | **94.0%** | 93.9–94.0% | 94.1% |
130
  | Web PDFs (`r2_test`), doc label | doc language | 2,695 | **94.3%** | 93.5–94.3% | 94.4% |
131
  | Government docs (`r3_test`, 21 scripts) | text layer / scan doc | 2,140 | **86.8%** | 86.8–86.9% | 87.6% |
132
+ | β€” `r3_test` clean text-layer (`tl == doc cfg`) | text layer = doc cfg | 995 | **96.3%** | β€” | 97.3% |
133
  | β€” `r3_test` scans subset | scan doc label | 789 | **90.1%** | 89.1–90.1% | 90.9% |
134
  | [MDPBench](https://huggingface.co/datasets/Delores-Lin/MDPBench), digital | benchmark lang | 680 | **95.6%** | 94.7–95.6% | 96.3% |
135
  | β€” digital Japanese (`jp`) / Russian (`ru`) | benchmark lang | 40 / 40 | **85.0% / 90.0%** | 85–88% / 80–90% | 82.5% / 82.5% |
 
169
 
170
  **ONNX ↔ PyTorch parity** (400 `r2_val` pages): `max |prob diff| = 2.0e-6`, **100.0% top-1 agreement**. Post-training INT8 quantization (both static QDQ and dynamic) was tested and **not shipped**: on MobileNetV4 depthwise convolutions, PTQ degraded agreement to 63.8% (static) / 6.5% (dynamic) without improving 1-thread CPU latency.
171
 
172
+ ## Bulk curation receipt (Common Crawl `CC-MAIN-2026-47`)
173
+
174
+ Run end-to-end on a single **pure-CPU** Hugging Face Job (`cpu-xl`, 16 vCPU, `$1.00/hr`, zero GPU) directly against `hf://buckets/commoncrawl/commoncrawl`:
175
+
176
+ - **21,490 pages** across **13,308 real November 2026 web PDFs** (9,335 unique hosts, 30 TLDs) in **10.5 minutes** for **$0.175** (`35.6 pages/s` end-to-end including WARC byte-range fetch, gzip decompress, PyMuPDF text extract + render, and ONNX inference).
177
+ - **98.7%** agreement with PDF text-layer Unicode script counts on answered born-digital pages (`97.9%` unthresholded).
178
+ - **13.4%** of pages (`2,883`) had no usable text layer (`<30` letters); visual routing immediately assigned a script to **74.5%** (`2,147`) across 15+ scripts and refused the remaining `736` blank/chart/unknown pages.
179
+ - Flagged **119 pages** whose text layer contained `β‰₯60` Latin characters (broken legacy font CMaps or wrong-language OCR) where the vision model identified the true non-Latin script at `β‰₯0.85` confidence (e.g. Cyrillic `0.978`, Armenian `0.995`), plus **276 mixed-script pages** (`1.3%`).
180
+
181
  ## Limits
182
 
183
  1. **Unseen scripts & look-alikes:** not an unseen-script detector. Unseen scripts that visually resemble trained scripts (e.g. Gurmukhi β†’ Devanagari, Sinhala β†’ Kannada/Telugu) or appear alongside secondary Latin headers are often accepted with moderate-to-high confidence.