-
-
Save RaphaelMeudec/c9c07f61981dda4d4ff742e020b6c4ba 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
for epoch in range(epoch_num): | |
for index in range(batches): | |
# [Batch Preparation] | |
# Generate fake inputs | |
generated_images = g.predict(x=image_blur_batch, batch_size=batch_size) | |
# Train multiple times discriminator on real and fake inputs | |
for _ in range(critic_updates): | |
d_loss_real = d.train_on_batch(image_full_batch, output_true_batch) | |
d_loss_fake = d.train_on_batch(generated_images, output_false_batch) | |
d_loss = 0.5 * np.add(d_loss_fake, d_loss_real) | |
d.trainable = False | |
# Train generator only on discriminator's decision and generated images | |
d_on_g_loss = d_on_g.train_on_batch(image_blur_batch, [image_full_batch, output_true_batch]) | |
d.trainable = True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment