Sinapsis docTR
Detection plus recognition for document text and geometry.
Overview
sinapsis-doctr integrates the docTR OCR stack as DocTROCRPrediction. It uses a two-stage pipeline: detect text regions in an image, then recognise the text associated with those regions. The Template converts docTR page, block, line and word output into ImageAnnotations attached to Sinapsis image packets.
OCR where geometry is as important as the words
For scans, forms, page annotations and document digitisation, word positions and confidences are often needed alongside transcription. A two-stage detector/recogniser lets you control the recognition architecture separately from detection and preserves word-level geometry for crop generation, quality checks and review UIs.
This is recognition-oriented OCR. It does not provide a natural-language extraction prompt or guarantee semantic table reconstruction. Its strengths are spatial text detection, recognition and page-processing controls (orientation, straightening and aspect ratio handling).
Installation
Requires Python 3.13+. The base package includes python-doctr[torch] and the Sinapsis integration:
uv pip install sinapsis-doctr
For the example with an image-folder reader:
uv pip install "sinapsis-doctr[sinapsis-data-readers]"
Optional features and dependencies
The base installation includes the dependencies required by the package. The following extras are declared in this package’s pyproject.toml; install only those needed by your workflow. They are standard Python optional dependencies, not separate execution profiles.
| Extra | Adds / when to select it |
|---|---|
sinapsis-data-readers |
Load external media or datasets into DataContainers. Dependencies: sinapsis-data-readers[opencv] |
sinapsis-data-writers |
Save the resulting DataContainer content to files. Dependencies: sinapsis-data-writers |
sinapsis-data-visualization |
Render plots or annotate results for inspection. Dependencies: sinapsis-data-visualization[visualization-matplotlib] |
all |
Bundle declared by this package; its manifest includes sinapsis-data-readers, sinapsis-data-writers, sinapsis-data-visualization. |
For example:
uv pip install "sinapsis-doctr[sinapsis-data-readers]"
The manifest also defines development-only dependency groups: dev (pre-commit, ruff, ty). These support source development and testing and are not runtime extras.
DocTROCRPrediction Template
| Attribute | Purpose |
|---|---|
det_arch |
Text detector backbone, e.g. fast_base (default). |
reco_arch |
Text recogniser, e.g. crnn_vgg16_bn (default). |
pretrained, pretrained_backbone |
Load available pretrained weights. |
assume_straight_pages, straighten_pages |
Control skew/orientation handling. |
detect_orientation, detect_language |
Optional page analysis. |
preserve_aspect_ratio, symmetric_pad |
Preprocessing and geometry preservation. |
recognized_characters_as_labels, artefact_type_as_labels |
Annotation label representation. |
Example: OCR a folder of scanned pages
Create my_doctr_agent.yaml:
agent:
name: my_doctr_agent
templates:
- template_name: Input
class_name: InputTemplate
attributes: {}
- template_name: Scans
class_name: FolderImageDatasetCV2
template_input: Input
attributes:
data_dir: dataset/input
- template_name: DocumentOCR
class_name: DocTROCRPrediction
template_input: Scans
attributes:
det_arch: fast_base
reco_arch: crnn_vgg16_bn
pretrained: true
preserve_aspect_ratio: true
detect_orientation: false
sinx jobs run my_doctr_agent.yaml
DocumentOCR adds bounding boxes, labels and recognition information to the input images. You can connect a visualization Template to inspect uncertain regions or retain geometry for indexing/review.
Shipped configurations: recognition and end-to-end demo.
Operational considerations
- Detector and recogniser model choices affect speed, accuracy, memory use and language coverage.
- Rotated or unusual layouts may benefit from the orientation and page-straightening switches rather than assuming straight pages.
- The annotation path retains spatial information; extracting one plain text string for a downstream LLM is a separate, optional workflow step.
Resources
License
Sinapsis open-source components are available under your choice of the MIT License or the Apache License 2.0, unless otherwise noted.
Metadata
Release files for sinapsis-doctr 1.0.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 |
|---|---|---|---|---|
| sinapsis_doctr-1.0.0.tar.gz | 126.6 kB | Without provenance | Details for sinapsis_doctr-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sinapsis_doctr-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for sinapsis_doctr-1.0.0-py3-none-any.whl |
Total release size: 140.9 kB
Release files / sinapsis_doctr-1.0.0.tar.gz
| Download URL | sinapsis_doctr-1.0.0.tar.gz |
|---|---|
| Size | 126.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ee1e3bdf2345fc4138bf06e8fd763e6f90fd49b8858c7ec627cedeb4e4fd4dcf
|
|
BLAKE2b-256 checksum How to use checksums |
d06a0e5d2f6eb7a502b83ca4f68625c3093a7549e668bdbc6d4ca1307cd68690
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.17
|
Release files / sinapsis_doctr-1.0.0-py3-none-any.whl
| Download URL | sinapsis_doctr-1.0.0-py3-none-any.whl |
|---|---|
| Size | 14.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b2e95567e60d585ae053a99133443fa9e40ddee82c3ff72821ee1b5d30400210
|
|
BLAKE2b-256 checksum How to use checksums |
dc7e3ba6e84239923393f033ba7c27ac534b17e3a9258f092c3cee77c2058f53
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.17
|
Security for sinapsis-doctr 1.0.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.