ocr

module
v0.0.0-...-d0a3c32 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 30, 2026 License: MIT

README

docstomd-ocr-local

docstomd's local OCR engine: CPU-only, pure Go (no cgo), a separate module so the core docstomd module keeps zero heavy dependencies and Go 1.26.

It speaks the docstomd OCR protocol, and docstomd reaches it like any third-party engine (--ocr-provider local).

go install github.com/m7medVision/docstomd-go/ocr/cmd/docstomd-ocr-local@latest
docstomd ocr install pp-ocrv5-mobile
docstomd convert --ocr auto --ocr-provider local scan.pdf
Package What it does
cmd/docstomd-ocr-local The engine binary: protocol session, model selection
pageimage Extracts a scanned page's image in pure Go (JPEG, Flate) with its placement, or renders it with pdftoppm (CCITT, JBIG2, vector text); reusable by adapter authors
engine Manifest-driven pipeline: detect → orient → recognize (DB post-processing, CTC decoding), denormal weights flushed at load
backend GoMLX backend selection: go (pure Go), onnx (ONNX Runtime via purego), auto
catalog Model and runtime catalog, verified installs, model selection

Models are described by a manifest next to their ONNX files.

Tests

go test ./... runs offline. Tests that need real models skip unless DOCSTOMD_OCR_TEST_MODELS names a models root with the model installed. DOCSTOMD_OCR_TEST_BACKEND=onnx (with DOCSTOMD_OCR_RUNTIMES pointing at an installed runtime) runs the same goldens on ONNX Runtime.

Vendored upstream code, with docstomd patches: internal/onnxgomlx (onnx-gomlx) and internal/computeonnx (compute-onnx); see their READMEs.

Directories

Path Synopsis
Package backend selects the GoMLX compute backend the local OCR engine runs on.
Package backend selects the GoMLX compute backend the local OCR engine runs on.
Package catalog finds, lists and installs local OCR models.
Package catalog finds, lists and installs local OCR models.
cmd
docstomd-ocr-local command
Command docstomd-ocr-local is docstomd's local OCR engine: it runs OCR models on the CPU, without cgo, and speaks the docstomd OCR protocol (docs/ocr-protocol.md) on stdin/stdout.
Command docstomd-ocr-local is docstomd's local OCR engine: it runs OCR models on the CPU, without cgo, and speaks the docstomd OCR protocol (docs/ocr-protocol.md) on stdin/stdout.
Package engine runs text detection, line orientation and text recognition models described by a manifest, on a GoMLX backend.
Package engine runs text detection, line orientation and text recognition models described by a manifest, on a GoMLX backend.
internal
computeonnx
Package onnxbackend implements an ONNX Runtime (ORT) compute backend for GoMLX (github.com/gomlx/compute).
Package onnxbackend implements an ONNX Runtime (ORT) compute backend for GoMLX (github.com/gomlx/compute).
computeonnx/internal/executionprovider
Package executionprovider defines the native GPU execution providers supported by the ONNX Runtime backend.
Package executionprovider defines the native GPU execution providers supported by the ONNX Runtime backend.
computeonnx/internal/ort
Package ort drives the ONNX Runtime C API through purego: the shared library is loaded at run time and its OrtApi function table is called directly, so builds need no cgo.
Package ort drives the ONNX Runtime C API through purego: the shared library is loaded at run time and its OrtApi function table is called directly, so builds need no cgo.
ocrtest
Package ocrtest holds helpers shared by the OCR module's tests: locating installed test models, fixtures and goldens.
Package ocrtest holds helpers shared by the OCR module's tests: locating installed test models, fixtures and goldens.
onnxgomlx/internal/onnxgomlx
Package togomlx contains several conversion utilities from ONNX and GoMLX.
Package togomlx contains several conversion utilities from ONNX and GoMLX.
onnxgomlx/internal/onnxgomlx/filesreader
Package filesreader implements the onnx.ExternalDataReader interface by reading files from a
Package filesreader implements the onnx.ExternalDataReader interface by reading files from a
onnxgomlx/internal/onnxgraph
Package onnxgraph provides graph-manipulation utilities for ONNX proto graphs.
Package onnxgraph provides graph-manipulation utilities for ONNX proto graphs.
onnxgomlx/onnx
Package onnx provides the public interface for ONNX models in GoMLX.
Package onnx provides the public interface for ONNX models in GoMLX.
onnxgomlx/onnx/parser
Package parser provides functions to parse ONNX models into GoMLX.
Package parser provides functions to parse ONNX models into GoMLX.
Package pageimage extracts the image of a scanned PDF page in pure Go, for OCR engines and adapter authors.
Package pageimage extracts the image of a scanned PDF page in pure Go, for OCR engines and adapter authors.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL