From 33dc4654e53caa97f73338daa0aad17249507a36 Mon Sep 17 00:00:00 2001 From: Marcel Date: Mon, 13 Apr 2026 13:16:25 +0200 Subject: [PATCH] fix(ocr): use correct Kraken record attributes for line geometry BaselineOCRRecord has 'baseline' and 'boundary' attributes, not 'line' and 'cuts'. The fallback used record.line which doesn't exist, causing AttributeError on every Kurrent OCR page. Co-Authored-By: Claude Opus 4.6 (1M context) --- ocr-service/engines/kraken.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ocr-service/engines/kraken.py b/ocr-service/engines/kraken.py index ce994dd7..5d967764 100644 --- a/ocr-service/engines/kraken.py +++ b/ocr-service/engines/kraken.py @@ -47,7 +47,7 @@ def extract_page_blocks(image, page_idx: int, language: str = "de") -> list[dict pred_it = rpred.rpred(_model, image, baseline_seg) for record in pred_it: - polygon_pts = record.cuts if hasattr(record, "cuts") else [] + polygon_pts = record.boundary if hasattr(record, "boundary") and record.boundary else [] if polygon_pts: xs = [p[0] for p in polygon_pts] @@ -55,8 +55,8 @@ def extract_page_blocks(image, page_idx: int, language: str = "de") -> list[dict x1, y1 = min(xs), min(ys) x2, y2 = max(xs), max(ys) else: - xs = [p[0] for p in record.line] - ys = [p[1] for p in record.line] + xs = [p[0] for p in record.baseline] + ys = [p[1] for p in record.baseline] x1, y1 = min(xs), min(ys) - 5 x2, y2 = max(xs), max(ys) + 5