mirror of
https://github.com/qurator-spk/sbb_binarization.git
synced 2025-06-07 19:35:04 +02:00
sbb_binarize: Start new session only once
This commit is contained in:
parent
14c5fcf5c1
commit
0f7d4c589a
1 changed files with 2 additions and 1 deletions
|
@ -29,6 +29,8 @@ class SbbBinarizer:
|
||||||
self.model_dir = model_dir
|
self.model_dir = model_dir
|
||||||
self.log = logger if logger else logging.getLogger('SbbBinarizer')
|
self.log = logger if logger else logging.getLogger('SbbBinarizer')
|
||||||
|
|
||||||
|
self.start_new_session()
|
||||||
|
|
||||||
def start_new_session(self):
|
def start_new_session(self):
|
||||||
config = tf.ConfigProto()
|
config = tf.ConfigProto()
|
||||||
config.gpu_options.allow_growth = True
|
config.gpu_options.allow_growth = True
|
||||||
|
@ -194,7 +196,6 @@ class SbbBinarizer:
|
||||||
raise ValueError("Must pass either a opencv2 image or an image_path")
|
raise ValueError("Must pass either a opencv2 image or an image_path")
|
||||||
if image_path is not None:
|
if image_path is not None:
|
||||||
image = cv2.imread(image_path)
|
image = cv2.imread(image_path)
|
||||||
self.start_new_session()
|
|
||||||
list_of_model_files = glob('%s/*.h5' % self.model_dir)
|
list_of_model_files = glob('%s/*.h5' % self.model_dir)
|
||||||
img_last = 0
|
img_last = 0
|
||||||
for n, model_in in enumerate(list_of_model_files):
|
for n, model_in in enumerate(list_of_model_files):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue