Image Classification
timm
ONNX
Safetensors
ocr
script-identification
page-classification
document-ai
multi-label
glam
hf_jobs
Instructions to use davanstrien/page-script-id-agent with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- timm
How to use davanstrien/page-script-id-agent with timm:
import timm model = timm.create_model("hf-hub:davanstrien/page-script-id-agent", pretrained=True) - Notebooks
- Google Colab
- Kaggle
Card: link Hugging Face Jobs, close open items (citations, seeds, photographs and handwriting)
Browse files
README.md
CHANGED
|
@@ -54,7 +54,7 @@ tags:
|
|
| 54 |
> **DRAFT β notes for review (delete this block before release)**
|
| 55 |
>
|
| 56 |
> 1. **Licence:** Apache-2.0 is set. Basis, from the licence fields on the Hub as checked on 2026-11-25: backbone `timm/mobilenetv4_conv_small.e2400_r224_in1k` Apache-2.0; the labelling models Valen-Decision-1.5-4B and Intern-Decision-4B Apache-2.0; Synthdog-Multilingual-100 Apache-2.0; FinePDFs ODC-By (attribution, given under Training); the sibling models page-ocr-flags and text-page-filter Apache-2.0. The pages themselves (web PDFs, library scans) carry their own rights, which is why only weights are released. This is a reading of licence fields, not legal advice.
|
| 57 |
-
> 2. **
|
| 58 |
|
| 59 |
# Page script ID
|
| 60 |
|
|
@@ -62,7 +62,7 @@ A small image model that looks at a whole document page and says which writing s
|
|
| 62 |
|
| 63 |
MobileNetV4-conv-small, 2.5M parameters, 10 MB as ONNX or as timm weights. Greyscale page squashed to 640 Γ 640. 33 ms per page on one CPU thread, 12 ms on four (model only).
|
| 64 |
|
| 65 |
-
Trained on Hugging Face Jobs: one A10G, about 23 minutes per run. Details are under [Training](#training).
|
| 66 |
|
| 67 |
> **Check the thresholds on your own pages.** The default cut-offs (0.55 for a script, 0.627 for "unknown") were chosen on web PDFs and do not carry over unchanged. The same rule returns "unknown" for 5% of web-PDF pages, 11.5% of government documents and half of photographed pages. Before you filter or route on the decision, run the model on a few hundred of your own pages, look at the probabilities, and set the cut-offs there.
|
| 68 |
|
|
@@ -202,7 +202,7 @@ All test pages come from documents never used in training. Labels are automatic,
|
|
| 202 |
| Held-out pages of web PDFs, 25 languages | document language (wrong for about 6% of pages) | 2,695 | 92.2% | 91.6β92.2% |
|
| 203 |
| The same pages where the text layer is usable | script of the text layer | 2,056 | 92.2% | 91.7β92.2% |
|
| 204 |
| Held-out government documents, 21 scripts | text layer; document language for scans | 2,140 | 86.1% | 85.7β86.1% |
|
| 205 |
-
| MDPBench, digital renders | benchmark language |
|
| 206 |
| MDPBench, photographed | benchmark language | 2,040 | 74.8% | 74.8β77.4% |
|
| 207 |
| Hard pages: blackletter, rotated, non-Latin in old books | four models agreed (unanimous) | 113 | 91.2% | 90.3β92.9% |
|
| 208 |
|
|
@@ -211,7 +211,7 @@ All test pages come from documents never used in training. Labels are automatic,
|
|
| 211 |
| Method | Accuracy | Cost |
|
| 212 |
|---|---|---|
|
| 213 |
| This model | 92.2% | 33 ms per page, one CPU thread |
|
| 214 |
-
| Script of the text from a full OCR pass (Indra OCR 1.2) | 96.4% | about 2.4 s per page per CPU core |
|
| 215 |
| Tesseract OSD | 55.0% | about 1.8 s per page |
|
| 216 |
| PaddleClas PULC `language_classification`, vote over detected text lines | 34.9% used as documented; 65.9% with lines cut into word-shaped windows | needs a text detector first; no Hebrew, Greek, Bengali or Thai class |
|
| 217 |
|
|
@@ -268,4 +268,4 @@ CPU times were measured on an earlier export of the same network with the normal
|
|
| 268 |
- **Negatives:** pages in scripts without a class (real Tibetan pages; synthetic Tibetan and Lao pages from [Synthdog-Multilingual-100](https://huggingface.co/datasets/WueNLP/Synthdog-Multilingual-100)), with every output at zero; this teaches "unknown". As many synthetic pages in trained scripts stop it learning "synthetic means unknown".
|
| 269 |
- **Recipe:** MobileNetV4-conv-small from ImageNet weights, greyscale pages squashed to 640 Γ 640, one sigmoid per script, class-balanced sampling, 8 epochs. One temperature, fitted on validation pages, calibrates the probabilities.
|
| 270 |
- Never trained on: the test documents, MDPBench, or the hard-page set.
|
| 271 |
-
- Trained on Hugging Face Jobs: one A10G (`a10g-large`), about 23 minutes (1,353 to 1,368 s) per training run.
|
|
|
|
| 54 |
> **DRAFT β notes for review (delete this block before release)**
|
| 55 |
>
|
| 56 |
> 1. **Licence:** Apache-2.0 is set. Basis, from the licence fields on the Hub as checked on 2026-11-25: backbone `timm/mobilenetv4_conv_small.e2400_r224_in1k` Apache-2.0; the labelling models Valen-Decision-1.5-4B and Intern-Decision-4B Apache-2.0; Synthdog-Multilingual-100 Apache-2.0; FinePDFs ODC-By (attribution, given under Training); the sibling models page-ocr-flags and text-page-filter Apache-2.0. The pages themselves (web PDFs, library scans) carry their own rights, which is why only weights are released. This is a reading of licence fields, not legal advice.
|
| 57 |
+
> 2. **Nothing else is open.** For the record: this repo holds one checkpoint, the best of three training seeds on validation pages; the other two are the source of the "3 seeds" ranges.
|
| 58 |
|
| 59 |
# Page script ID
|
| 60 |
|
|
|
|
| 62 |
|
| 63 |
MobileNetV4-conv-small, 2.5M parameters, 10 MB as ONNX or as timm weights. Greyscale page squashed to 640 Γ 640. 33 ms per page on one CPU thread, 12 ms on four (model only).
|
| 64 |
|
| 65 |
+
Trained on [Hugging Face Jobs](https://huggingface.co/docs/hub/jobs): one A10G, about 23 minutes per run. Details are under [Training](#training).
|
| 66 |
|
| 67 |
> **Check the thresholds on your own pages.** The default cut-offs (0.55 for a script, 0.627 for "unknown") were chosen on web PDFs and do not carry over unchanged. The same rule returns "unknown" for 5% of web-PDF pages, 11.5% of government documents and half of photographed pages. Before you filter or route on the decision, run the model on a few hundred of your own pages, look at the probabilities, and set the cut-offs there.
|
| 68 |
|
|
|
|
| 202 |
| Held-out pages of web PDFs, 25 languages | document language (wrong for about 6% of pages) | 2,695 | 92.2% | 91.6β92.2% |
|
| 203 |
| The same pages where the text layer is usable | script of the text layer | 2,056 | 92.2% | 91.7β92.2% |
|
| 204 |
| Held-out government documents, 21 scripts | text layer; document language for scans | 2,140 | 86.1% | 85.7β86.1% |
|
| 205 |
+
| [MDPBench](https://huggingface.co/datasets/Delores-Lin/MDPBench), digital renders | benchmark language | 680 | 90.4% | 88.8β90.4% |
|
| 206 |
| MDPBench, photographed | benchmark language | 2,040 | 74.8% | 74.8β77.4% |
|
| 207 |
| Hard pages: blackletter, rotated, non-Latin in old books | four models agreed (unanimous) | 113 | 91.2% | 90.3β92.9% |
|
| 208 |
|
|
|
|
| 211 |
| Method | Accuracy | Cost |
|
| 212 |
|---|---|---|
|
| 213 |
| This model | 92.2% | 33 ms per page, one CPU thread |
|
| 214 |
+
| Script of the text from a full OCR pass ([Indra OCR](https://huggingface.co/datalab-to/indra-ocr) 1.2) | 96.4% | about 2.4 s per page per CPU core |
|
| 215 |
| Tesseract OSD | 55.0% | about 1.8 s per page |
|
| 216 |
| PaddleClas PULC `language_classification`, vote over detected text lines | 34.9% used as documented; 65.9% with lines cut into word-shaped windows | needs a text detector first; no Hebrew, Greek, Bengali or Thai class |
|
| 217 |
|
|
|
|
| 268 |
- **Negatives:** pages in scripts without a class (real Tibetan pages; synthetic Tibetan and Lao pages from [Synthdog-Multilingual-100](https://huggingface.co/datasets/WueNLP/Synthdog-Multilingual-100)), with every output at zero; this teaches "unknown". As many synthetic pages in trained scripts stop it learning "synthetic means unknown".
|
| 269 |
- **Recipe:** MobileNetV4-conv-small from ImageNet weights, greyscale pages squashed to 640 Γ 640, one sigmoid per script, class-balanced sampling, 8 epochs. One temperature, fitted on validation pages, calibrates the probabilities.
|
| 270 |
- Never trained on: the test documents, MDPBench, or the hard-page set.
|
| 271 |
+
- Trained on [Hugging Face Jobs](https://huggingface.co/docs/hub/jobs) with `hf jobs uv run` (a single self-contained script with its dependencies declared inline; see the [Jobs guide](https://huggingface.co/docs/huggingface_hub/guides/jobs)): one A10G (`a10g-large`), about 23 minutes (1,353 to 1,368 s) per training run.
|