model.compile(optimizer=opt, loss=custom_mse) model.summary() start_from = 0 save_every_n_epoch = 5 n_epochs = 10000 # model.load_weights("../weights/implementation7d-reg-55.h5") # start image downloader ip = None g = h5_small_vgg_generator(b_size, "../h5_data", ip) gval = h5_small_vgg_generator(b_size, "../h5_validate", None) for i in range(start_from // save_every_n_epoch, n_epochs // save_every_n_epoch): print("START", i * save_every_n_epoch, "/", n_epochs) history = model.fit_generator(g, steps_per_epoch=60000/b_size, epochs=save_every_n_epoch, validation_data=gval, validation_steps=(1024//b_size)) model.save_weights("../weights/implementation8-res-" + str(i * save_every_n_epoch) + ".h5") # save sample images whole_image_check_overlapping(model, 40, "imp8-res-" + str(i * save_every_n_epoch) + "-") # save history output = open('../history/imp8-res-{:0=4d}.pkl'.format(i * save_every_n_epoch), 'wb') pickle.dump(history.history, output) output.close()
model.compile(optimizer=opt, loss=custom_mse, metrics=[root_mean_squared_error, mean_squared_error]) model.summary() start_from = 0 save_every_n_epoch = 1 n_epochs = 10000 # model.load_weights("../weights/implementation9-bn-24.h5") # start image downloader ip = None g = h5_small_vgg_generator(b_size, "../data/h5_small_train", ip) gval = h5_small_vgg_generator(b_size, "../data/h5_small_validation", None) for i in range(start_from // save_every_n_epoch, n_epochs // save_every_n_epoch): print("START", i * save_every_n_epoch, "/", n_epochs) history = model.fit_generator(g, steps_per_epoch=100000//b_size, epochs=save_every_n_epoch, validation_data=gval, validation_steps=(10000//b_size)) model.save_weights("../weights/implementation9-bn-" + str(i * save_every_n_epoch) + ".h5") # save sample images whole_image_check_overlapping(model, 80, "imp9-bn-" + str(i * save_every_n_epoch) + "-") # save history output = open('../history/imp9-bn-{:0=4d}.pkl'.format(i * save_every_n_epoch), 'wb') pickle.dump(history.history, output) output.close()