From a6b502d4ccfa7bd3acc0772ea8dbfab115be2373 Mon Sep 17 00:00:00 2001 From: starcolon Date: Tue, 25 Apr 2017 00:47:01 +0700 Subject: [PATCH] (trivial) skip loading model if not exist --- loader.py | 1 - model/core.py | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/loader.py b/loader.py index 465a6ff..33e204d 100644 --- a/loader.py +++ b/loader.py @@ -108,7 +108,6 @@ def train(samples): # NOTE: Automatically continue training the existing model # Otherwise, starts a new model if there is no model file found. cnn = train_model( - # TAOTODO: Should load the correct model path_model if os.path.isfile(path_model) else None, trainsetX, trainsetY, diff --git a/model/core.py b/model/core.py index 0804abe..f5a4538 100644 --- a/model/core.py +++ b/model/core.py @@ -25,8 +25,8 @@ def train_model(path, X, y, X_, y_, image_dim, final_vec_dim, epoch, batch_size): # Create a new CNN - if path is None: - print(colored('Creating a new CNN.','green')) + if path is None or not os.path.isfile(path + '0'): + print(colored('Creating a new CNN.','cyan')) cnn = CNN(image_dim, final_vec_dim) else: print(colored('Loading model from : {0}'.format(path),'green'))