mciancone commited on
Commit
287bed8
·
verified ·
1 Parent(s): d6043d9

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +82 -82
README.md CHANGED
@@ -1,82 +1,82 @@
1
- ---
2
- license: apache-2.0
3
- pipeline_tag: image-classification
4
- tags:
5
- - image-classification
6
- - multi-label-classification
7
- - onnx
8
- - openvino
9
- - pdf
10
- - document-understanding
11
- - rag
12
- datasets:
13
- - Wikit/PdfVisClassif
14
- ---
15
-
16
- # PDF Page Classifier
17
-
18
- Multi-label classifier for PDF page images. Determines whether a PDF page
19
- requires image embedding (vs. text-only) in RAG pipelines.
20
-
21
- Backbone: EfficientNet-Lite0. Exported to ONNX and OpenVINO INT8 via
22
- Quantization-Aware Training (QAT). **No PyTorch required at inference time.**
23
-
24
- ## Classes
25
-
26
- - `Complex Table`
27
- - `Simple Table`
28
- - `Visual - Essential`
29
- - `Visual - Supportive`
30
-
31
- Pages matching any of the following classes should trigger image embedding:
32
-
33
- - `Complex Table`
34
- - `Visual - Essential`
35
-
36
- Default threshold: `0.5`
37
-
38
- ## Usage
39
-
40
- ### With [chunknorris](https://github.com/wikit-ai/chunknorris) (recommended)
41
-
42
- ```bash
43
- pip install "chunknorris[ml-onnx]" # ONNX backend
44
- pip install "chunknorris[ml-openvino]" # OpenVINO INT8, fastest on CPU
45
- ```
46
-
47
- ```python
48
- from chunknorris.ml import load_classifier
49
-
50
- clf = load_classifier("Wikit/pdf-pages-classifier") # auto-selects best available backend
51
- result = clf.predict("page.png")
52
- # {"needs_image_embedding": True, "predicted_classes": [...], "probabilities": {...}}
53
- ```
54
-
55
- ### Standalone (no chunknorris)
56
-
57
- ```bash
58
- git clone https://huggingface.co/Wikit/pdf-pages-classifier
59
- cd pdf-pages-classifier
60
- pip install onnxruntime Pillow numpy # or: openvino Pillow numpy
61
- ```
62
-
63
- ```python
64
- from classifiers import load_classifier
65
-
66
- clf = load_classifier(".") # auto-selects available backend
67
- result = clf.predict("page.png")
68
- ```
69
-
70
- ## Files
71
-
72
- | File | Format | Notes |
73
- |------|--------|-------|
74
- | `model.onnx` | ONNX FP32 | Cross-platform CPU/GPU inference |
75
- | `openvino_model.xml/.bin` | OpenVINO INT8 | Fastest CPU inference (QAT) |
76
- | `pytorch_model.bin` | PyTorch | Raw checkpoint; requires `torch` + `timm` |
77
- | `config.json` | JSON | Preprocessing config and class names |
78
- | `classifiers/` | Python | Standalone inference scripts (no chunknorris needed) |
79
-
80
- ## Dataset
81
-
82
- Trained on [Wikit/PdfVisClassif](https://huggingface.co/datasets/Wikit/PdfVisClassif).
 
1
+ ---
2
+ license: apache-2.0
3
+ pipeline_tag: image-classification
4
+ tags:
5
+ - image-classification
6
+ - multi-label-classification
7
+ - onnx
8
+ - openvino
9
+ - pdf
10
+ - document-understanding
11
+ - rag
12
+ datasets:
13
+ - Wikit/PdfVisClassif
14
+ ---
15
+
16
+ # PDF Page Classifier
17
+
18
+ Multi-label classifier for PDF page images. Determines whether a PDF page
19
+ requires image embedding (vs. text-only) in RAG pipelines.
20
+
21
+ Backbone: EfficientNet-Lite0. Exported to ONNX and OpenVINO INT8 via
22
+ Quantization-Aware Training (QAT). **No PyTorch required at inference time.**
23
+
24
+ ## Classes
25
+
26
+ - `Complex Table`
27
+ - `Simple Table`
28
+ - `Visual - Essential`
29
+ - `Visual - Supportive`
30
+
31
+ Pages matching any of the following classes should trigger image embedding:
32
+
33
+ - `Complex Table`
34
+ - `Visual - Essential`
35
+
36
+ Default threshold: `0.5`
37
+
38
+ ## Usage
39
+
40
+ ### With [chunknorris](https://github.com/wikit-ai/chunknorris) (recommended)
41
+
42
+ ```bash
43
+ pip install "chunknorris[ml-onnx]" # ONNX backend
44
+ pip install "chunknorris[ml-openvino]" # OpenVINO INT8, fastest on CPU
45
+ ```
46
+
47
+ ```python
48
+ from chunknorris.ml import load_classifier
49
+
50
+ clf = load_classifier("Wikit/pdf-pages-classifier") # auto-selects best available backend
51
+ result = clf.predict("page.png")
52
+ # {"needs_image_embedding": True, "predicted_classes": [...], "probabilities": {...}}
53
+ ```
54
+
55
+ ### Standalone (no chunknorris)
56
+
57
+ ```bash
58
+ git clone https://huggingface.co/Wikit/pdf-pages-classifier
59
+ cd pdf-pages-classifier
60
+ pip install onnxruntime Pillow numpy # or: openvino Pillow numpy
61
+ ```
62
+
63
+ ```python
64
+ from classifiers import load_classifier
65
+
66
+ clf = load_classifier(".") # auto-selects available backend
67
+ result = clf.predict("page.png")
68
+ ```
69
+
70
+ ## Files
71
+
72
+ | File | Format | Notes |
73
+ |------|--------|-------|
74
+ | `model.onnx` | ONNX FP32 | Cross-platform CPU/GPU inference |
75
+ | `openvino_model.xml/.bin` | OpenVINO INT8 | Fastest CPU inference (QAT) |
76
+ | `pytorch_model.bin` | PyTorch | Raw checkpoint; requires `torch` + `timm` |
77
+ | `config.json` | JSON | Preprocessing config and class names |
78
+ | `classifiers/` | Python | Standalone inference scripts (no chunknorris needed) |
79
+
80
+ ## Dataset
81
+
82
+ Trained on [Wikit/PdfVisClassif](https://huggingface.co/datasets/Wikit/PdfVisClassif).