🐛 typo: comment{,s}, fix #8

pull/11/head
Konstantin Baierer 4 years ago
parent d675ffc066
commit c4b63fca47

@ -57,7 +57,7 @@ class SbbBinarizeProcessor(Processor):
oplevel = self.parameter['operation_level']
model_path = self.parameter['model'] # pylint: disable=attribute-defined-outside-init
binarizer = SbbBinarizer(model_dir=model_path)
binarizer = SbbBinarizer(model_dir=model_path, logger=LOG)
for n, input_file in enumerate(self.input_files):
file_id = make_file_id(input_file, self.output_file_grp)
@ -77,7 +77,7 @@ class SbbBinarizeProcessor(Processor):
file_id + '.IMG-BIN',
page_id=input_file.pageId,
file_grp=self.output_file_grp)
page.add_AlternativeImage(AlternativeImageType(filename=bin_image_path, comment='%s,binarized' % page_xywh['features']))
page.add_AlternativeImage(AlternativeImageType(filename=bin_image_path, comments='%s,binarized' % page_xywh['features']))
elif oplevel == 'region':
regions = page.get_AllRegions(['Text', 'Table'], depth=1)

@ -17,13 +17,16 @@ from keras.models import load_model
sys.stderr = stderr
import tensorflow as tf
import logging
def resize_image(img_in, input_height, input_width):
return cv2.resize(img_in, (input_width, input_height), interpolation=cv2.INTER_NEAREST)
class SbbBinarizer:
def __init__(self, model_dir):
def __init__(self, model_dir, logger=None):
self.model_dir = model_dir
self.log = logger if logger else logging.getLogger('SbbBinarizer')
def start_new_session(self):
config = tf.ConfigProto()
@ -193,7 +196,8 @@ class SbbBinarizer:
self.start_new_session()
list_of_model_files = listdir(self.model_dir)
img_last = 0
for model_in in list_of_model_files:
for n, model_in in enumerate(list_of_model_files):
self.log.info('Predicting with model %s [%s/%s]' % (model_in, n + 1, len(list_of_model_files)))
res = self.predict(model_in, image, use_patches)

Loading…
Cancel
Save