October 2018
Intermediate to advanced
472 pages
10h 57m
English
This Python file contains the four functions, upscale(), generated_images_plot(), plot_generated_images_combined(), and plot_training_loss():
"""This module contains functions to plot image generated when training GAN."""import matplotlib.pyplot as pltimport numpy as npdef upscale(image): """Scale the image to 0-255 scale.""" return (image*127.5 + 127.5).astype(np.uint8)def generated_images_plot(original, noised_data, generator): """Plot subplot of images during training.""" print('NOISED') for i in range(9): plt.subplot(331 + i) plt.axis('off') plt.imshow(upscale(np.squeeze(noised_data[i])), cmap='gray') plt.show() print('GENERATED') for i in range(9): pred = generator.predict(noised_data[i:i+1], verbose=0)Read now
Unlock full access