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)