sbb_binarize: Start new session only once

pull/17/head
Lucas Sulzbach 4 years ago
parent 14c5fcf5c1
commit 0f7d4c589a

@ -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…
Cancel
Save