From fe973e58db11a6339e6b3d335a61b18bffd2d7d6 Mon Sep 17 00:00:00 2001 From: Konstantin Baierer Date: Thu, 17 Dec 2020 18:07:38 +0100 Subject: [PATCH 1/2] add version of calamari in --version output --- ocrd_calamari/recognize.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ocrd_calamari/recognize.py b/ocrd_calamari/recognize.py index b21f6ed..381cac3 100644 --- a/ocrd_calamari/recognize.py +++ b/ocrd_calamari/recognize.py @@ -5,6 +5,7 @@ import itertools from glob import glob import numpy as np +from calamari_ocr import __version__ as calamari_version from calamari_ocr.ocr import MultiPredictor from calamari_ocr.ocr.voting import voter_from_proto from calamari_ocr.proto import VoterParams @@ -33,7 +34,7 @@ class CalamariRecognize(Processor): def __init__(self, *args, **kwargs): kwargs['ocrd_tool'] = OCRD_TOOL['tools'][TOOL] - kwargs['version'] = OCRD_TOOL['version'] + kwargs['version'] = '%s (calamari %s)' % (OCRD_TOOL['version'], calamari_version) super(CalamariRecognize, self).__init__(*args, **kwargs) def _init_calamari(self): From fdd30ebb8932cc34f25cdce75d84d21d3ade95ae Mon Sep 17 00:00:00 2001 From: Konstantin Baierer Date: Tue, 22 Dec 2020 16:34:27 +0100 Subject: [PATCH 2/2] also add tensorflow version to --version output --- ocrd_calamari/recognize.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ocrd_calamari/recognize.py b/ocrd_calamari/recognize.py index 381cac3..06af5dc 100644 --- a/ocrd_calamari/recognize.py +++ b/ocrd_calamari/recognize.py @@ -27,6 +27,9 @@ from ocrd_utils import ( from ocrd_calamari.config import OCRD_TOOL, TF_CPP_MIN_LOG_LEVEL +os.environ['TF_CPP_MIN_LOG_LEVEL'] = TF_CPP_MIN_LOG_LEVEL +from tensorflow import __version__ as tensorflow_version + TOOL = 'ocrd-calamari-recognize' @@ -34,11 +37,10 @@ class CalamariRecognize(Processor): def __init__(self, *args, **kwargs): kwargs['ocrd_tool'] = OCRD_TOOL['tools'][TOOL] - kwargs['version'] = '%s (calamari %s)' % (OCRD_TOOL['version'], calamari_version) + kwargs['version'] = '%s (calamari %s, tensorflow %s)' % (OCRD_TOOL['version'], calamari_version, tensorflow_version) super(CalamariRecognize, self).__init__(*args, **kwargs) def _init_calamari(self): - os.environ['TF_CPP_MIN_LOG_LEVEL'] = TF_CPP_MIN_LOG_LEVEL checkpoints = glob(self.parameter['checkpoint']) self.predictor = MultiPredictor(checkpoints=checkpoints)