Pass1_Lite
Drop-in crop refinement between your layout detector and OCR VLM.
Cuts real-world text edit distance from 0.0519 to 0.0403 (-22.4% relative, +0.48/100 Real5 overall; -41.9% on Skew, -28.0% on Screen photos) with zero retraining, zero PyTorch, and ≈1.00× runtime (0.9986× All6 / 1.0047× Real5).
GitHub Repository & Visual Before/After Showcase · 简体中文文档 · Full Statistical Audit · Upstream PR Patches
Why Pass1_Lite?
Two-stage document OCR (Layout Detector → Crop → VLM) loses accuracy in the wild for three simple, fixable reasons:
- Skewed crops pull in neighbor text — Axis-aligned boxes absorb adjacent headings, columns, and captions.
Pass1_Litemasks exterior pixels using a+4 pxdilated polygon filled with local 85th-percentile paper luminance (no clipped strokes, no harsh gray seams). - Phone photos of screens break VLM vision encoders — LCD RGB subpixel moiré scrambles digits and small words.
Pass1_Liteauto-detects subpixel chroma oscillation on native pages and applies text-only luminance LPF +2×upscaling (tables & formulas stay untouched;<0.9%of Clean regions (5/298 pages)). - Detectors invert vertical order inside columns —
Pass1_Literuns a deterministic, idempotent same-column order repair pass before Markdown assembly.
Why not full-page deskew or raw
crop(bbox)? Two-pass deskew regresses Clean (-0.33) and Scanning (-0.60) while adding+3.6%latency; rawcrop(bbox)or 0 px hard-white/gray masks leave neighbor bleed, clipped strokes, or unmitigated screen moiré.Pass1_Liteis the zero-regression middle layer verified on 1,788 blind images.Lightweight & honest scope: Only
numpy,opencv-python-headless, andpillow(zerotorch). All benchmark gains below were measured onXiaomi-OCR-0 (0.8B)+PaddleX PP-DocLayoutV3; the Python/CLI adapters also acceptHuggingFace/ custom JSON layouts and any OpenAI-compatible VLM endpoint (vLLM,Qwen-VL, etc.) via--preset generic(gains on other VLMs have not been benchmarked here).
30-Second Quickstart
pip install pass1-lite
# 1. Try instantly with zero GPU / zero models (generates side-by-side comparison.png)
pass1-lite demo --out-dir ./demo_out
# 2. Diagnose LCD moire & EXIF rotation risks on any real photo
pass1-lite inspect ./scan.jpg
# 3. End-to-end two-stage OCR -> Markdown (PaddleX -> Pass1_Lite -> vLLM)
pass1-lite ocr ./pages/ --paddlex \
--vllm-url http://127.0.0.1:8000/v1 --model Xiaomi-OCR-0 \
--out-dir ./md_out --save-visual --resume
Python API (6 Lines, Zero Glue Code)
from pass1_lite import from_paddlex_result, load_image_rgb, ocr_page_crops, prepare_page_crops
img = load_image_rgb("page.jpg")
regions = from_paddlex_result(paddlex_pred, *img.size, table_threshold=0.25) # or from_hf_detections(...)
bundle = prepare_page_crops(img, regions)
markdown, _ = ocr_page_crops(bundle, base_url="http://127.0.0.1:8000/v1", model="Xiaomi-OCR-0")
Benchmark (298 Held-Out Docs × 6 Domains = 1,788 Images)
| Pipeline | Clean | Screen | Skew | Warping | Real5 Overall | Real5 Text Error ↓ | All6 Runtime |
|---|---|---|---|---|---|---|---|
Standard Baseline (official_base) |
95.62 |
94.19 |
92.10 |
95.25 |
94.47 |
0.0519 |
1.000× |
Pass1_Lite (Single-Pass Default) |
95.63 |
94.80 |
93.47 |
95.52 |
94.95 (+0.48) |
0.0403 (-22.4%) |
0.9986× |
Two-Pass Full-Page Deskew (sysfix_v1) |
95.29 (-0.33) |
94.80 |
95.73 |
94.99 (-0.26) |
95.17 |
0.0388 |
1.036× |
Best value(s) per column are bolded. Pass1_Lite row reports the GPU-verified v0.2 default (Real5=94.9491, Skew=93.4685, Warping=95.5222); the pre-registered frozen run (fill_ratio_mode="frozen_unclipped") scored Real5=94.9424 (Skew=93.4812, Warping=95.4761; paired text_ED diff 0.0000, p=0.71).
- Safe production default: Statistically significant text error reduction in 6/6 domains (
p ≤ 0.039) with 0 domain regressions (Clean+0.01, Real5 text ED0.0519 → 0.0403/-22.4%,+0.48/100overall,181docs improved /21worse /68tied), at ≈1.00× runtime (0.9986×All6,1.0047×Real5;3.6%faster than two-pass deskew). - Honest scope: Statistically significant gains are in text (
p < 0.001) and reading order (p < 0.001). Table (p=0.89) and formula (p=0.33) deltas vs baseline are not statistically significant. Against two-pass deskew,Pass1_Litemissed pre-registered non-inferiority (G4 FAIL,-0.22Real5 overall) because severe skew formulas still favor full-page rotation (cdm_pg 96.24vs90.97), at the cost of Clean (-0.33), Warping (-0.26), and Scanning (-0.60) regressions.
See the GitHub repository for real-dataset before/after visual comparisons, full statistical audit (G1–G4, pretraining overlap disclosure, v0.2 GPU parity), CLI guardrails, and standalone upstream PR patches.
License
Apache-2.0 (LICENSE · NOTICE). PyPI wheel and sdist packages contain pure Apache-2.0 code and the original numeric benchmark chart only (zero dataset images or benchmark page-ID manifests).
Metadata
Release files for pass1-lite 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pass1_lite-0.2.0.tar.gz | 333.3 kB | Without provenance | Details for pass1_lite-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pass1_lite-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for pass1_lite-0.2.0-py3-none-any.whl |
Total release size: 371.8 kB
Release files / pass1_lite-0.2.0.tar.gz
| Download URL | pass1_lite-0.2.0.tar.gz |
|---|---|
| Size | 333.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b43e0f1eecdd629a2274c017f8eceef9bf5d08617f6079a494c2acf90e8d9c81
|
|
BLAKE2b-256 checksum How to use checksums |
59ed6c2b52cb46710de0aaca7f42c8539343bdfcbda9c8037fe753f373ead458
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.15
|
Release files / pass1_lite-0.2.0-py3-none-any.whl
| Download URL | pass1_lite-0.2.0-py3-none-any.whl |
|---|---|
| Size | 38.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
84b5a004e603050e28aa9099fcd535cf3ff188bf77b3125e4684de28ed1494cb
|
|
BLAKE2b-256 checksum How to use checksums |
b15c9ec7b68edbf4f4a8b6b88bc5d4e977e4e89e9660a772e64c8da8c713adfd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.15
|
Security for pass1-lite 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.