mirror of
https://github.com/mikegerber/ocrd_calamari.git
synced 2025-07-22 16:39:54 +02:00
Merge pull request #50 from OCR-D/add-calamari-version
add version of calamari in --version output
This commit is contained in:
commit
962f115ed6
1 changed files with 5 additions and 2 deletions
|
@ -5,6 +5,7 @@ import itertools
|
||||||
from glob import glob
|
from glob import glob
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
from calamari_ocr import __version__ as calamari_version
|
||||||
from calamari_ocr.ocr import MultiPredictor
|
from calamari_ocr.ocr import MultiPredictor
|
||||||
from calamari_ocr.ocr.voting import voter_from_proto
|
from calamari_ocr.ocr.voting import voter_from_proto
|
||||||
from calamari_ocr.proto import VoterParams
|
from calamari_ocr.proto import VoterParams
|
||||||
|
@ -26,6 +27,9 @@ from ocrd_utils import (
|
||||||
|
|
||||||
from ocrd_calamari.config import OCRD_TOOL, TF_CPP_MIN_LOG_LEVEL
|
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'
|
TOOL = 'ocrd-calamari-recognize'
|
||||||
|
|
||||||
|
|
||||||
|
@ -33,11 +37,10 @@ class CalamariRecognize(Processor):
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
kwargs['ocrd_tool'] = OCRD_TOOL['tools'][TOOL]
|
kwargs['ocrd_tool'] = OCRD_TOOL['tools'][TOOL]
|
||||||
kwargs['version'] = OCRD_TOOL['version']
|
kwargs['version'] = '%s (calamari %s, tensorflow %s)' % (OCRD_TOOL['version'], calamari_version, tensorflow_version)
|
||||||
super(CalamariRecognize, self).__init__(*args, **kwargs)
|
super(CalamariRecognize, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
def _init_calamari(self):
|
def _init_calamari(self):
|
||||||
os.environ['TF_CPP_MIN_LOG_LEVEL'] = TF_CPP_MIN_LOG_LEVEL
|
|
||||||
|
|
||||||
checkpoints = glob(self.parameter['checkpoint'])
|
checkpoints = glob(self.parameter['checkpoint'])
|
||||||
self.predictor = MultiPredictor(checkpoints=checkpoints)
|
self.predictor = MultiPredictor(checkpoints=checkpoints)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue