From 3b02da8da2d54cffb0864e893d78b78cf2327813 Mon Sep 17 00:00:00 2001 From: "Gerber, Mike" Date: Thu, 8 Aug 2019 12:50:11 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A7=20Set=20TensorFlow=20minimum=20log?= =?UTF-8?q?=20level?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ocrd_calamari/config.py | 1 + ocrd_calamari/ocr.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ocrd_calamari/config.py b/ocrd_calamari/config.py index 01e0b23..6141ca2 100644 --- a/ocrd_calamari/config.py +++ b/ocrd_calamari/config.py @@ -2,3 +2,4 @@ import json from pkg_resources import resource_string OCRD_TOOL = json.loads(resource_string(__name__, 'ocrd-tool.json').decode('utf8')) +TF_CPP_MIN_LOG_LEVEL = '3' # '3' == ERROR diff --git a/ocrd_calamari/ocr.py b/ocrd_calamari/ocr.py index f0dc7d2..181fcd7 100644 --- a/ocrd_calamari/ocr.py +++ b/ocrd_calamari/ocr.py @@ -14,7 +14,7 @@ from ocrd_models.ocrd_page import to_xml from ocrd_models.ocrd_page_generateds import TextEquivType from ocrd_utils import getLogger, concat_padded, polygon_from_points, MIMETYPE_PAGE -from ocrd_calamari.config import OCRD_TOOL +from ocrd_calamari.config import OCRD_TOOL, TF_CPP_MIN_LOG_LEVEL log = getLogger('processor.CalamariOcr') @@ -28,6 +28,8 @@ class CalamariOcr(Processor): super(CalamariOcr, self).__init__(*args, **kwargs) def _init_calamari(self): + os.environ['TF_CPP_MIN_LOG_LEVEL'] = TF_CPP_MIN_LOG_LEVEL + checkpoints = glob('/home/mike/devel/experiments/train-calamari-gt4histocr/models/*.ckpt.json') # XXX self.predictor = MultiPredictor(checkpoints=checkpoints)