mirror of
https://github.com/mikegerber/ocrd_calamari.git
synced 2025-06-09 11:49:53 +02:00
disable tensorflow/keras print-to-stdout with tf_disable_interactive_logs, OCR-D/core#1091
This commit is contained in:
parent
ab9182be1b
commit
823b5923ac
2 changed files with 15 additions and 7 deletions
|
@ -2,4 +2,3 @@ import json
|
||||||
from pkg_resources import resource_string
|
from pkg_resources import resource_string
|
||||||
|
|
||||||
OCRD_TOOL = json.loads(resource_string(__name__, 'ocrd-tool.json').decode('utf8'))
|
OCRD_TOOL = json.loads(resource_string(__name__, 'ocrd-tool.json').decode('utf8'))
|
||||||
TF_CPP_MIN_LOG_LEVEL = '3' # '3' == ERROR
|
|
||||||
|
|
|
@ -5,6 +5,21 @@ import itertools
|
||||||
from glob import glob
|
from glob import glob
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
from ocrd_utils import (
|
||||||
|
assert_file_grp_cardinality,
|
||||||
|
concat_padded,
|
||||||
|
coordinates_for_segment,
|
||||||
|
getLogger,
|
||||||
|
make_file_id,
|
||||||
|
points_from_polygon,
|
||||||
|
polygon_from_x0y0x1y1,
|
||||||
|
MIMETYPE_PAGE,
|
||||||
|
tf_disable_interactive_logs,
|
||||||
|
)
|
||||||
|
|
||||||
|
# Disable tensorflow/keras logging via print before importing calamari
|
||||||
|
tf_disable_interactive_logs()
|
||||||
|
|
||||||
from calamari_ocr import __version__ as calamari_version
|
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
|
||||||
|
@ -18,12 +33,6 @@ from ocrd_models.ocrd_page import (
|
||||||
WordType, GlyphType, CoordsType,
|
WordType, GlyphType, CoordsType,
|
||||||
to_xml
|
to_xml
|
||||||
)
|
)
|
||||||
from ocrd_utils import (
|
|
||||||
getLogger, concat_padded,
|
|
||||||
coordinates_for_segment, points_from_polygon, polygon_from_x0y0x1y1,
|
|
||||||
make_file_id, assert_file_grp_cardinality,
|
|
||||||
MIMETYPE_PAGE
|
|
||||||
)
|
|
||||||
|
|
||||||
from ocrd_calamari.config import OCRD_TOOL, TF_CPP_MIN_LOG_LEVEL
|
from ocrd_calamari.config import OCRD_TOOL, TF_CPP_MIN_LOG_LEVEL
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue