OCR-D / ocrd_kraken

Wrapper for the kraken OCR engine
Apache License 2.0
10 stars 6 forks source link

use multi-model recognition #37

Open bertsky opened 1 year ago

bertsky commented 1 year ago

Kraken offers "multi-script" (actually multi-model) prediction in one pass, so instead of a fixed model, we could run with multiple models and use the annotated language and script mappings to select per-segment (as in ocrd-tesserocr-recognize with xpath_model).

IIUC, that would entail using mm_rpred (instead of rpred) and passing lang/script to bounds['boxes'][...]['tags'] (or bounds['lines'][...]['tags'] with baseline segmentation) and a dict from lang/script to model names as the first arg.

bertsky commented 1 month ago

After the Kraken v5 API changes, this would now mean passing the dict to .tags per segmentation.lines.