checkboxer / npboxdetect
Fastest checkbox detector. NumPy + Numba. No deep learning.
Benchmark
| Approach | p50 (ms) | boxes | vs npboxdetect |
|---|---|---|---|
| npboxdetect | 34ms | 69 | baseline |
| boxdetect | 60ms | 67 | 1.8x slower |
| opencv_contours | 33ms | 179 | ~same (but noisy) |
| morphology | 34ms | 25 | ~same (misses many) |
50-run p50, full pipeline including imread, on 2200×1700 document images.
Pure processing (imread excluded):
| Image | npboxdetect | boxdetect | Speedup |
|---|---|---|---|
| lc_application1.png | 6.5ms | 25.5ms | 3.9x |
| lc_application2.png | 7.1ms | 18.6ms | 2.6x |
Usage
from npboxdetect.detector import get_boxes
boxes = get_boxes("form.png")
# [(x, y, w, h), ...]
How it works
Five steps, all near-hardware-limit:
downsample 2x ~0ms stride view, zero copy
otsu + threshold 1.4ms fused numba: histogram → binarize in one shot
morph open 1.3ms numba parallel run-length scan (rows+cols)
connected components 1.3ms cv2.connectedComponentsWithStats
NMS 0.2ms vectorized pairwise IoU matrix
─────────────────────────────
processing total ~6ms
Key ideas:
- 2x downsample before processing — free stride view, halves pixel count
- Fused numba otsu+threshold — one serial histogram pass + one parallel binarize pass, no cv2 call
- Run-length morph open — each row/column independent →
prangeparallelism, no cumsum overhead - Filter before NMS — size/ratio filter drops 1000+ blobs to ~70 before NMS
Install
git clone https://github.com/santhoshkammari/checkboxer
cd checkboxer
pip install numba opencv-python numpy
Journey
See JOURNEY.md (v0→v6, 4248ms→37ms) and JOURNEY2.md (v7→v10, 37ms→6ms).
Author
Metadata
Release files for npboxdetect 0.1.2
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 |
|---|---|---|---|---|
| npboxdetect-0.1.2.tar.gz | 17.3 MB | Without provenance | Details for npboxdetect-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| npboxdetect-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for npboxdetect-0.1.2-py3-none-any.whl |
Total release size: 17.3 MB
Release files / npboxdetect-0.1.2.tar.gz
| Download URL | npboxdetect-0.1.2.tar.gz |
|---|---|
| Size | 17.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d72a50c6db53b6670e1e89e157c932dfb54b814d06f2a60f9f6fe4ea4a840689
|
|
BLAKE2b-256 checksum How to use checksums |
03268f4c6c07914e46e5effaa5410b91983f5466a59b8b92a95ef56f5349d3a5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / npboxdetect-0.1.2-py3-none-any.whl
| Download URL | npboxdetect-0.1.2-py3-none-any.whl |
|---|---|
| Size | 7.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
15c7dcd07ebdc9e15ffc1c2c7d2ef69505cdc659134e2cf95ae941466d0a5545
|
|
BLAKE2b-256 checksum How to use checksums |
472fb40d82c7ae31c271569448cfa229def726ef95acdada709df4769d8c265f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Security for npboxdetect 0.1.2
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.