Widget Detector
End-to-end document form widget detection using YOLO11m, automatically downloading fine-tuned weights from Hugging Face.
Detects 3 classes of form fields from scanned PDFs and document images:
| Class ID | Name | Description |
|---|---|---|
| 0 | text_input |
Text boxes, input lines |
| 1 | choice_button |
Checkboxes + radio buttons |
| 2 | signature |
Signature fields |
Installation
You can install the package directly from PyPI:
pip install psynx-widget-detector
Requires Python 3.11+
Quickstart
The package will automatically download the fine-tuned YOLO11m weights from Hugging Face (PSynx/widget-detector-yolo) the first time you run it.
from widget_detector import WidgetDetector
# 1. Initialize the detector (downloads weights automatically if not found)
detector = WidgetDetector()
# 2. Run inference on a PDF (auto-renders pages to images)
result = detector.detect_path("sample_form.pdf")
# 3. Print the results
print(f"Detected {result.total_widgets} widgets across {result.total_pages} pages.")
for page in result.pages:
print(f"\nPage {page.page}:")
for widget in page.widgets:
print(f" - {widget.class_name} ({widget.confidence:.2f}) at "
f"[{widget.bbox.x1:.1f}, {widget.bbox.y1:.1f}, {widget.bbox.x2:.1f}, {widget.bbox.y2:.1f}]")
# 4. Save results to JSON
result.save("output.json")
Output Format
The detector returns a structured Pydantic object that cleanly serializes to JSON:
{
"source": "form.pdf",
"total_pages": 3,
"total_widgets": 24,
"pages": [
{
"source": "form.pdf",
"page": 1,
"image_width": 1654,
"image_height": 2339,
"processing_time_ms": 142.3,
"widgets": [
{
"class_id": 0,
"class_name": "text_input",
"confidence": 0.913,
"bbox": {
"x1": 120.0, "y1": 340.0, "x2": 480.0, "y2": 380.0,
"x1_norm": 0.073, "y1_norm": 0.145,
"x2_norm": 0.290, "y2_norm": 0.163
},
"page": 1
}
]
}
]
}
Notes
- CommonForms
choice_buttonincludes both checkboxes and radio buttons as one class (the dataset does not distinguish them). - Inference Speed: If you have a CUDA-enabled GPU, the
WidgetDetectorwill automatically use it for highly accelerated inference.
Metadata
Release files for psynx-widget-detector 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 |
|---|---|---|---|---|
| psynx_widget_detector-0.1.2.tar.gz | 13.5 kB | Without provenance | Details for psynx_widget_detector-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| psynx_widget_detector-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for psynx_widget_detector-0.1.2-py3-none-any.whl |
Total release size: 30.1 kB
Release files / psynx_widget_detector-0.1.2.tar.gz
| Download URL | psynx_widget_detector-0.1.2.tar.gz |
|---|---|
| Size | 13.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
20a8320107dfebf37adb5539e07079e4900777664ea022b50624660c9862d016
|
|
BLAKE2b-256 checksum How to use checksums |
3577d1a4a23e61e2eae259945fd16db810810073a93a1aa7498b89df44ad61c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Release files / psynx_widget_detector-0.1.2-py3-none-any.whl
| Download URL | psynx_widget_detector-0.1.2-py3-none-any.whl |
|---|---|
| Size | 16.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4cfbd8e3c70bcb5a25818e930ac777624ff0bc946d7b63f34de048cf59a47767
|
|
BLAKE2b-256 checksum How to use checksums |
913a188b816430916ca8e5ba8a28bf5fff91c64a72d9f48f526dfbcc1e26bf0b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Security for psynx-widget-detector 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.