-
-
Save RaphaelMeudec/1c0ed2dbdef394d2ab854d63161487d9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Load dataset | |
data = load_images('./images/train', n_images) | |
y_train, x_train = data['B'], data['A'] | |
# Initialize models | |
g = generator_model() | |
d = discriminator_model() | |
d_on_g = generator_containing_discriminator_multiple_outputs(g, d) | |
# Initialize optimizers | |
g_opt = Adam(lr=1E-4, beta_1=0.9, beta_2=0.999, epsilon=1e-08) | |
d_opt = Adam(lr=1E-4, beta_1=0.9, beta_2=0.999, epsilon=1e-08) | |
d_on_g_opt = Adam(lr=1E-4, beta_1=0.9, beta_2=0.999, epsilon=1e-08) | |
# Compile models | |
d.trainable = True | |
d.compile(optimizer=d_opt, loss=wasserstein_loss) | |
d.trainable = False | |
loss = [perceptual_loss, wasserstein_loss] | |
loss_weights = [100, 1] | |
d_on_g.compile(optimizer=d_on_g_opt, loss=loss, loss_weights=loss_weights) | |
d.trainable = True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment