ocracy.backends.paddleocr.adapter#
Adapter for PaddleOCR — image -> text + quad boxes via PP-OCR.
PaddleOCR 3.x replaced the 2.x API: the constructor refuses 2.x keywords such as
show_log, predict() returns result objects holding rec_texts /
rec_scores / rec_polys instead of 2.x ocr()’s [[box, (text, score)],
...], and language names changed (3.x takes ISO codes). The adapter tells the two
apart by whether PaddleOCR has predict (2.x accepts any keyword, so a
constructor error cannot), then builds and parses accordingly. The 3.x document
pre-processors (page orientation, unwarping, text-line orientation) are off: they
are for photographed pages, and they slow every call. Engines are cached per
language.
Functions
|
Line blocks from one 2.x page ( |
|
Line blocks from one 3.x result ( |
|
Whether a PaddleOCR pipeline class has the 3.x API ( |
Classes
|
PaddleOCR adapter (caches one engine per language). |
- class ocracy.backends.paddleocr.adapter.Adapter(config)[source]#
Bases:
BaseOcrAdapterPaddleOCR adapter (caches one engine per language).
- ocracy.backends.paddleocr.adapter.blocks_from_v2(page)[source]#
Line blocks from one 2.x page (
[[box, (text, score)], ...]).- Return type: