if opt.load_from is not None: model.load_weights(opt.load_from) DSSIM_L1 = get_dssim_l1_loss() model.compile(optimizer='adam', loss=DSSIM_L1, metrics=['mse', DSSIM_L1]) sources = TransformedLRSR(opt) tensorboard = TensorBoard(log_dir=os.path.join(opt.checkpoints_dir, 'logs'), histogram_freq=0, batch_size=32, write_graph=True, write_grads=False, write_images=True) checkpointer = ModelCheckpoint(filepath=os.path.join(opt.checkpoints_dir, 'weights.hdf5'), verbose=1, save_best_only=True) model.fit_generator(make_generator(sources['train'], batch_size=opt.batch_size), validation_data=make_generator(sources['test'], batch_size=opt.batch_size), validation_steps=4, steps_per_epoch=200, epochs=1000, verbose=2, callbacks=[checkpointer, tensorboard]) export_model_to_js(model, opt.work_dir + '/__js_model__')
def export(self, my): opt = self._opt export_model_to_js(self.model, opt.work_dir+'/__js_model__')