【发布时间】:2017-08-17 00:41:13
【问题描述】:
我正在尝试了解去噪自动编码器。我已经按照这个 keras 教程 - https://blog.keras.io/building-autoencoders-in-keras.html
在本教程中,通过以下方式添加人工噪声来创建训练数据:
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)
产生:
这意味着来自 MINST 数据集的噪声以及基础数据的值介于 0 和 1 之间。
我正在尝试仅使用非常少的人工噪声来训练模型,但间隔为 -5 到 5,如下所示:
def noise_matrix(arr, num, min, max):
m = np.product(arr.shape)
arr.ravel()[np.random.randint(0, m, size=num)] = np.random.uniform(min, max, num)
return arr
x_train_noisy = noise_matrix(x_train, x_train.shape[0] * 2, -5, 5)
x_test_noisy = noise_matrix(x_test, x_test.shape[0] * 2, -5, 5)
产生:
(上图对比不同是matplotlib库中隐式归一化造成的)
现在,当我训练自动编码器并应用模型时,我得到以下结果:
大部分噪音都没有消除。为了消除区间(-5,5) 中的噪音,我需要执行哪些步骤?在将噪声添加到区间 (0,1) 后,我尝试对所有数据进行归一化,但这不是要走的路(我用这种方法得到了非常糟糕的结果)。
【问题讨论】:
标签: tensorflow neural-network deep-learning keras autoencoder