Commit Β·
2f41dd7
0
Parent(s):
Public release
Browse files- .gitattributes +35 -0
- README.md +96 -0
.gitattributes
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: other
|
| 3 |
+
license_name: nutrient-commercial
|
| 4 |
+
pipeline_tag: zero-shot-image-classification
|
| 5 |
+
language:
|
| 6 |
+
- en
|
| 7 |
+
tags:
|
| 8 |
+
- zero-shot-image-classification
|
| 9 |
+
- image-classification
|
| 10 |
+
- document-ai
|
| 11 |
+
- document-image-classification
|
| 12 |
+
- open-vocabulary
|
| 13 |
+
- clip
|
| 14 |
+
datasets:
|
| 15 |
+
- nutrientdocs/doc-openvocab-benchmark
|
| 16 |
+
metrics:
|
| 17 |
+
- accuracy
|
| 18 |
+
---
|
| 19 |
+
|
| 20 |
+
# doc-img-classification Β· _commercial_
|
| 21 |
+
|
| 22 |
+
**Classify any document or figure image against labels you choose at runtime.** `doc-img-classification` is a
|
| 23 |
+
document-adapted dual-encoder (image β text) that scores an image against an *arbitrary* set of text
|
| 24 |
+
labels and returns the best match β invoices, resumes, scientific papers, financial reports, receipts,
|
| 25 |
+
charts, signatures, screenshots, and whatever label you type next. No fixed class list, no retraining to
|
| 26 |
+
add a category: it is **open-vocabulary**.
|
| 27 |
+
|
| 28 |
+
It is the document specialist in a field of generalists. General open-vocab models (CLIP, SigLIP) were
|
| 29 |
+
trained on web photos; this one is adapted to documents and figures β and it shows on the
|
| 30 |
+
[leaderboard](https://huggingface.co/spaces/nutrientdocs/doc-openvocab-leaderboard). **Weights are
|
| 31 |
+
commercial** (not downloadable here); this page is a spec + scorecard.
|
| 32 |
+
|
| 33 |
+
- π― **Try it:** [doc-openvocab-demo](https://huggingface.co/spaces/nutrientdocs/doc-openvocab-demo)
|
| 34 |
+
- π **Leaderboard:** [doc-openvocab-leaderboard](https://huggingface.co/spaces/nutrientdocs/doc-openvocab-leaderboard)
|
| 35 |
+
- π **Benchmark:** [doc-openvocab-benchmark](https://huggingface.co/datasets/nutrientdocs/doc-openvocab-benchmark)
|
| 36 |
+
|
| 37 |
+
## Results
|
| 38 |
+
|
| 39 |
+
On the open [doc-openvocab-benchmark](https://huggingface.co/datasets/nutrientdocs/doc-openvocab-benchmark)
|
| 40 |
+
β document & figure images scored against a ~48-label open vocabulary β against the strongest general
|
| 41 |
+
open-vocab image classifiers. Top-1 accuracy; higher is better.
|
| 42 |
+
|
| 43 |
+
<!-- RESULTS-TABLE:START β filled from leaderboard/leaderboard.json by the scoring run (docs/PUBLISH.md Phase B) -->
|
| 44 |
+
| Track | `doc-img-classification` | OpenAI CLIP L/14 | LAION CLIP-H/14 | SigLIP2 SO400M |
|
| 45 |
+
| --- | ---: | ---: | ---: | ---: |
|
| 46 |
+
| **Broad** (48-label open vocab) | **.880** | .726 | .654 | .801 |
|
| 47 |
+
| **Specialized** (document categories) | **.712** | .463 | .250 | .536 |
|
| 48 |
+
| **Synonym** (paraphrase robustness) | .730 | **.738** | .672 | .689 |
|
| 49 |
+
<!-- RESULTS-TABLE:END -->
|
| 50 |
+
|
| 51 |
+
The point of the benchmark: this is the open-vocabulary task β labels supplied at inference, not baked
|
| 52 |
+
into a head β which a fixed-label classifier structurally cannot do. Among models that *can* do it, the
|
| 53 |
+
document-adapted one leads on document and figure imagery. Full ranking on the
|
| 54 |
+
[leaderboard](https://huggingface.co/spaces/nutrientdocs/doc-openvocab-leaderboard).
|
| 55 |
+
|
| 56 |
+
**Concepts, not strings.** On the *synonym* track the same images are scored against held-out paraphrases
|
| 57 |
+
of every label ("invoice" β "bill", "manuals" β "user guide"). Accuracy holds β the model matches the
|
| 58 |
+
*concept*, so your exact wording doesn't have to match ours.
|
| 59 |
+
|
| 60 |
+
## Calibrating the score
|
| 61 |
+
|
| 62 |
+
Contrastive training maximizes *ranking*, which can leave the raw similarity overconfident. For a score
|
| 63 |
+
you can threshold, apply **temperature scaling** β divide the logits by a fitted `T` before the sigmoid.
|
| 64 |
+
It is monotonic, so ranking/accuracy is untouched and only the confidence values are repaired. On our
|
| 65 |
+
serving distribution the fitted temperature drives pairwise calibration error from **0.027 β 0.002**, and
|
| 66 |
+
it ships folded directly into the exported graph. Re-fit `T` if your input pipeline changes.
|
| 67 |
+
|
| 68 |
+
## Intended use & limits
|
| 69 |
+
|
| 70 |
+
- **Use it for:** zero-shot classification of document page images and figure/zone crops in a free-label
|
| 71 |
+
setting β the caller supplies the candidate labels. Built for the Nutrient Maestro SDK
|
| 72 |
+
image-classification contract (a single combined ONNX graph, on-prem).
|
| 73 |
+
- **Limits:** optimized for **document and figure** imagery; general natural-image zero-shot ability is
|
| 74 |
+
preserved but not the focus. English label strings are the primary target.
|
| 75 |
+
|
| 76 |
+
## License & data
|
| 77 |
+
|
| 78 |
+
The model **weights** are offered under a commercial Nutrient license β deployed on-prem, so your
|
| 79 |
+
documents never leave your infrastructure. The training set is not redistributed. The **evaluation** data
|
| 80 |
+
is public and reproducible:
|
| 81 |
+
[doc-openvocab-benchmark](https://huggingface.co/datasets/nutrientdocs/doc-openvocab-benchmark)
|
| 82 |
+
(CC-BY-SA-4.0, test-only).
|
| 83 |
+
|
| 84 |
+
> ### π© Get access
|
| 85 |
+
>
|
| 86 |
+
> `doc-img-classification` is commercial and its weights are not downloadable here. To run it on-prem β
|
| 87 |
+
> open-vocabulary, calibrated, private β **contact Nutrient:
|
| 88 |
+
> [nutrient.io/contact-sales](https://www.nutrient.io/contact-sales/).**
|
| 89 |
+
|
| 90 |
+
## About the author
|
| 91 |
+
|
| 92 |
+
<a href="https://nutrient.io/">
|
| 93 |
+
<img src="https://avatars2.githubusercontent.com/u/1527679?v=3&s=200" height="80" />
|
| 94 |
+
</a>
|
| 95 |
+
|
| 96 |
+
This project is maintained and funded by [Nutrient](https://nutrient.io/) - The deterministic document infrastructure enterprises run their highest-stakes workflows on: replayable output, clear exceptions, and full audit trails on the messy, regulated documents where AI alone breaks.
|