Created
April 22, 2019 12:17
-
-
Save wmlba/e01f8a77b98d8836cd6a8c612bbaf389 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
# The code below is from the Keras Blogs | |
# https://blog.keras.io/building-autoencoders-in-keras.html | |
noise_factor = 0.5 | |
x_train_noisy = x_train + noise_factor * np.random.normal(loc=0.0, scale=1.0, size=x_train.shape) | |
x_test_noisy = x_test + noise_factor * np.random.normal(loc=0.0, scale=1.0, size=x_test.shape) | |
x_train_noisy = np.clip(x_train_noisy, 0., 1.) | |
x_test_noisy = np.clip(x_test_noisy, 0., 1.) | |
#Print one image to see the noise | |
plt.imshow(x_test_noisy[1].reshape(28, 28)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment