ocracy.backends.rapidocr.adapter#
Adapter for RapidOCR — image -> text + quad boxes via ONNXRuntime PP-OCR.
rapidocr 3.x runs the same PP-OCRv6 models as PaddleOCR through ONNX, without
PaddlePaddle (measured in thorwhalen/ocracy#22). Its
result is an object with boxes / txts / scores (all None when
nothing is found). The adapter builds the v6 pipeline at the requested lang and
model_size (one engine cached per pair).
An install that only has the older rapidocr_onnxruntime package (PP-OCRv4,
which can drop word spaces) keeps working: the adapter falls back to it, ignores
lang / model_size there (that package selects scripts itself).
Module Attributes
PP-OCRv6 is multilingual, so |
Functions
|
Line blocks from |
|
Line blocks from a 3.x result object ( |
Whether the |
|
|
The |
Classes
|
RapidOCR adapter (caches one engine per |
- class ocracy.backends.rapidocr.adapter.Adapter(config)[source]#
Bases:
BaseOcrAdapterRapidOCR adapter (caches one engine per
(lang, model_size)).
- ocracy.backends.rapidocr.adapter.OCR_VERSION = 'PP-OCRv6'#
PP-OCRv6 is multilingual, so
langselects the recogniser’s script set andmodel_sizethe size of both detector and recogniser.
- ocracy.backends.rapidocr.adapter.blocks_from_legacy(result)[source]#
Line blocks from
rapidocr_onnxruntime’s[[box, text, score], ...](orNone).- Return type:
- ocracy.backends.rapidocr.adapter.blocks_from_v3(result)[source]#
Line blocks from a 3.x result object (
boxes/txts/scores).- Return type: