【发布时间】:2019-06-10 01:04:21
【问题描述】:
我正在使用 Keras 的样本去噪自动编码器; https://keras.io/examples/mnist_denoising_autoencoder/
在编译时,我使用以下选项:
autoencoder.compile(loss='mse', optimizer= Adadelta, metrics=['accuracy'])
接着是训练。我故意进行了训练,没有使用嘈杂的训练data(x_train_noisy),但只是试图恢复x_train。
autoencoder.fit(x_train, x_train, epochs=30, batch_size=128)
在训练了 60,000 个 MNIST 数字输入后,它给了我 81.25% 的准确率。这是否意味着有 60000*81.25% 的图像被 PERFECTLY 恢复(等于原始输入逐个像素),即自动编码器的 81.25% 输出图像是 IDENTICAL给他们的输入对应物,还是其他什么?
此外,我还通过逐个像素比较输出和原始数据(60000 个 28X28 矩阵)进行了手动检查——从它们的差异中计算非零元素:
x_decoded = autoencoder.predict(x_train)
temp = x_train*255
x_train_uint8 = temp.astype('uint8')
temp = x_decoded*255
x_decoded_uint8 = temp.astype('uint8')
c = np.count_nonzero(x_train_uint8 - x_decoded_uint8)
cp = 1-c /60000/28/28
然而 cp 仅为 71% 左右。谁能告诉我为什么会有差异?
【问题讨论】:
标签: python keras autoencoder