From df530877dc0a4b04d9d266ace7ead7930ed091fa Mon Sep 17 00:00:00 2001 From: Konstantin Baierer Date: Thu, 17 Dec 2020 17:18:29 +0100 Subject: [PATCH] check for empty line image, ht @andbue, fix #48 --- ocrd_calamari/recognize.py | 1 + 1 file changed, 1 insertion(+) diff --git a/ocrd_calamari/recognize.py b/ocrd_calamari/recognize.py index b21f6ed..b621a63 100644 --- a/ocrd_calamari/recognize.py +++ b/ocrd_calamari/recognize.py @@ -74,6 +74,7 @@ class CalamariRecognize(Processor): line_images_np = [] for (line_no, line) in enumerate(textlines): line_image, line_coords = self.workspace.image_from_segment(line, region_image, region_xywh) + 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) raw_results_all = self.predictor.predict_raw(line_images_np, progress_bar=False)