def create_models(dataset_dir): """Initialize the app (available for localhost only) Parameters: dataset_dir (:func:`str`): Path to the training set """ logger.debug("Creating models...") if not local_exec: logger.error("Models can only be generated locally") exit(1) # Modify the configuration for local execution app_config['root'] = os.environ['ROOT'] # Generate inline models and train classifier denoiser = Denoiser(app_config) if not exists(dataset_dir) or not isdir(dataset_dir): logger.error(dataset_dir+" is not a valid directory") exit(2) dataset = [join(dataset_dir, f) for f in listdir(dataset_dir)] denoiser.generate_models(dataset) logger.info("Inline models generated") denoiser.train(dataset) logger.info("Classifier trained")
def create_models(dataset_dir): """Initialize the app (available for localhost only) Parameters: dataset_dir (:func:`str`): Path to the training set """ logger.debug("Creating models...") if not local_exec: logger.error("Models can only be generated locally") exit(1) # Modify the configuration for local execution app_config['root'] = os.environ['ROOT'] # Generate inline models and train classifier denoiser = Denoiser(app_config) if not exists(dataset_dir) or not isdir(dataset_dir): logger.error(dataset_dir + " is not a valid directory") exit(2) dataset = [join(dataset_dir, f) for f in listdir(dataset_dir)] denoiser.generate_models(dataset) logger.info("Inline models generated") denoiser.train(dataset) logger.info("Classifier trained")
def mae_albdiv_bn(train_data, test_data): """Train the MAE denoiser with albedo divide and batch norm on. Use all features.""" config.ALBEDO_DIVIDE = True feature_list = ["normal", "albedo", "depth"] denoiser = Denoiser( train_data, test_data, adam_lr=1e-4, num_epochs= 100000, # Stupid number of epochs, early stopping will prevent reaching this early_stopping=True, kernel_predict=True, bn=True, feature_list=feature_list, num_layers=7, batch_size=64, loss="mae", model_dir="../experiments/models/mae_albdiv_bn", log_dir="../experiments/logs/mae_albdiv_bn") denoiser.buildNetwork() denoiser.train()
def vgg_albdiv_bn(train_data, test_data): """Train the vgg denoiser with albedo divide and batch norm. Use all features""" config.ALBEDO_DIVIDE = True feature_list = ["normal", "albedo", "depth"] denoiser = Denoiser( train_data, test_data, adam_lr=1e-3, num_epochs=100000, early_stopping=True, kernel_predict=True, bn=True, feature_list=feature_list, num_layers=7, batch_size=64, loss="vgg22", model_dir="../experiments/models/vgg_albdiv_bn", log_dir="../experiments/logs/vgg_albdiv_bn", ) denoiser.buildNetwork() denoiser.train()