From 0869386ec4191e7f2b2c96163d5e002eb70c6d35 Mon Sep 17 00:00:00 2001 From: "Gerber, Mike" Date: Tue, 9 Feb 2021 19:57:03 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20word=20and=20glyph=20coord?= =?UTF-8?q?inates?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes GH-57. --- ocrd_calamari/recognize.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ocrd_calamari/recognize.py b/ocrd_calamari/recognize.py index 817d6d5..43b8930 100644 --- a/ocrd_calamari/recognize.py +++ b/ocrd_calamari/recognize.py @@ -87,6 +87,7 @@ class CalamariRecognize(Processor): textlines = region.get_TextLine() log.info("About to recognize %i lines of region '%s'", len(textlines), region.id) line_images_np = [] + line_coordss = [] for line in textlines: log.debug("Recognizing line '%s' in region '%s'", line.id, region.id) @@ -101,9 +102,10 @@ class CalamariRecognize(Processor): line_image = line_image if all(line_image.size) else [[0]] line_image_np = np.array(line_image, dtype=np.uint8) line_images_np.append(line_image_np) + line_coordss.append(line_coords) raw_results_all = self.predictor.predict_raw(line_images_np, progress_bar=False) - for line, raw_results in zip(textlines, raw_results_all): + for line, line_coords, raw_results in zip(textlines, line_coordss, raw_results_all): for i, p in enumerate(raw_results): p.prediction.id = "fold_{}".format(i)