Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, path):
# base info
self.path = os.path.abspath(path)
self.logic = Logic(self.path)
# model related data
self.model = None
self.accu = None
self.model_path = os.path.join(self.path, 'model.yml')
self.weights_path = os.path.join(self.path, 'model.h5')
self.fdeep_path = os.path.join(self.path, 'model.fdeep')
# training related data
self.dataset = Dataset(self.path)
self.txt_stats_path = os.path.join(self.path, 'stats.txt')
self.json_stats_path = os.path.join(self.path, 'stats.json')
self.history_path = os.path.join(self.path, 'history.json')
self.classes_path = os.path.join(self.path, 'classes.json')
self.history = None
self.classes = None
self.what = {
'train' : "Training --------------------------------------------\n",
def get_symbols(name, symbols):
doer = Logic.get_doer(name)
ret = []
for symbol in symbols:
if symbol not in doer.__dict__:
return None, "%s does not define a %s function" % (name, symbol)
else:
ret.append(doer.__dict__[symbol])
return ret, None
def load(self):
preparers, err = Logic.get_symbols(self.preparer_path, ('prepare_dataset', 'prepare_input'))
if err is not None:
return err
else:
self.dataset_preparer, self.input_preparer = preparers
self.builder, err = Logic.get_symbol(self.builder_path, 'build_model')
if err is not None:
return err
self.trainer, err = Logic.get_symbol(self.trainer_path, 'train_model')
if err is not None:
return err
return None
def load(self):
preparers, err = Logic.get_symbols(self.preparer_path, ('prepare_dataset', 'prepare_input'))
if err is not None:
return err
else:
self.dataset_preparer, self.input_preparer = preparers
self.builder, err = Logic.get_symbol(self.builder_path, 'build_model')
if err is not None:
return err
self.trainer, err = Logic.get_symbol(self.trainer_path, 'train_model')
if err is not None:
return err
return None