自动编码器(Autoencoder)图像去噪(image denoising)实战
去噪或降噪是从信号中去除噪声的过程。这些噪声可以是图像、音频或文档之中的随机杂乱信息。你可以训练自动编码器网络来学习如何从图片中去除噪声。为了尝试这个用例,让我们重新使用著名的MNIST数据集,并在数据集中创建一些合成噪声。下面的代码将简单地向数据集添加一些噪声,然后绘制一些图片,以确保我们已经成功创建了它们。
#
# 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