jimnoneill commited on
Commit
fa87009
·
verified ·
1 Parent(s): 6d4eb17

Document the selectable PDF backend (pdfplumber default, pymupdf opt-in)

Browse files
Files changed (1) hide show
  1. README.md +13 -0
README.md CHANGED
@@ -81,6 +81,19 @@ Three feature channels concatenated into a **542-dimensional** vector, fed to a
81
 
82
  Each classifier head is a single linear layer stored as a numpy `.npz` file (10 KB). Inference is pure numpy, no torch required at prediction time.
83
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  ## Performance
85
 
86
  Evaluated against human-validated labels (three-reviewer survey with blinded adjudication of contested documents):
 
81
 
82
  Each classifier head is a single linear layer stored as a numpy `.npz` file (10 KB). Inference is pure numpy, no torch required at prediction time.
83
 
84
+ ## PDF backend (speed vs license)
85
+
86
+ Feature extraction reads PDFs through a selectable backend:
87
+
88
+ | Backend | Libraries | License | Speed | Notes |
89
+ |---------|-----------|---------|-------|-------|
90
+ | `pdfplumber` (**default**) | pdfplumber + pypdfium2 | MIT + BSD-3-Clause | ~2.0 s/doc | The stack the released model is trained on; reproduces the paper. |
91
+ | `pymupdf` | PyMuPDF | AGPL-3.0 | ~1.2 s/doc (about 1.75x faster) | Faster, but AGPL. Install with `pip install poster-sentry[pymupdf]`. Its extracted features differ slightly, so retrain with this backend for best accuracy or accept minor prediction drift. |
92
+
93
+ Select the backend with `--backend`, the `backend=` constructor argument, or the `POSTER_SENTRY_BACKEND` environment variable. The default is `pdfplumber` so results match this model.
94
+
95
+ On a 40-document corpus sample, the dominant cost in the default stack is pdfplumber's pure-Python text and structure parsing (about 780 ms and 760 ms per document); page rendering with pypdfium2 adds about 490 ms. A pypdfium2-based text variant cuts the text step to about 75 ms and reaches roughly 1.3 s/doc, but it changes the extracted text, so it would require its own retrain; `pymupdf` is the recommended fast path when AGPL is acceptable.
96
+
97
  ## Performance
98
 
99
  Evaluated against human-validated labels (three-reviewer survey with blinded adjudication of contested documents):