validate_start_path=validate_start_path, weights_path=weights_path, var_filename=var_filename) # model creation model = Mod.get_model(filters=filters, le=learn_rate, decay=decay_rate) weights_loaded = False if load_weights: weights_loaded = Mod.load_weights() if not weights_loaded: Mod.save_weights() Mod.plot_loss(500) Mod.check_performance(train_generator, times=check_perf_times) callbacks = md.Callbacks(ModelClass=Mod, save_modulo_epochs=save_modulo, printDecay=printDecay, collectLoss=collectLoss) # go if validate: Mod.validate(validateMode=mode, preprocessFunc=validatePreprocessFunc, draw=draw, onlyWithMetric=onlyWithMetric, onlyWithoutMetric=onlyWithoutMetric, sumTimes=sumTimes) else: for loop in range(total_ep): i = loop + 1 print("ep:" + str(i))
Mod = md.Models(rows, cols, mode=mode, channels=channels_in, show_function=show_function, read_func=read_function, validate_path_provider_func=validate_path_provider_func, validate_start_path=validate_start_path, weights_path=weights_path, var_filename=var_filename) # model creation model = Mod.get_model(filters=filters, le=learn_rate, decay=decay_rate) weights_loaded = False if load_weights: weights_loaded = Mod.load_weights() if not weights_loaded: Mod.save_weights() Mod.check_performance(train_generator, times=check_perf_times, metrics= metrics) callbacks = md.Callbacks(ModelClass=Mod, save_modulo_epochs=save_modulo, printDecay=printDecay, collectLoss=collectLoss, message='Model no.: '+str(j+1)) # go if validate: results = Mod.validate(validateMode=mode, preprocessFunc=validatePreprocessFunc, draw=draw, onlyWithMetric=onlyWithMetric, onlyWithoutMetric=onlyWithoutMetric, sumTimes=sumTimes, metrics=metrics, validTimes=6, validName='Zanik', weightsTimesValids=100) sum = list(map(add, sum, results)) else: for loop in range(total_ep): i = loop + 1 print("ep:" + str(i)) model.fit_generator(train_generator, steps_per_epoch=steps, epochs=ep, callbacks=[callbacks]) if i % loop_modulo == 0: Mod.check_performance(train_generator, times=check_perf_times_in_loop)