Keras编码器 - 用于MNIST的解码器 - >新图像

时间:2017-08-26 12:20:02

标签: keras mnist encoder decoder

我正在尝试在Keras中安装编码器 - 解码器网络,以非常好的方式预测来自MNIST数据集的图像。现在,我更改了图像输入,以便显示苹果。作为参考,这里是一个链接: http://farm3.static.flickr.com/2133/2203251029_008e350792.jpg

我正在将图像转换为灰度并将其大小调整为28x28。但是,当我现在运行与MNIST数据集相同的网络时,我只得到一个黑色图像作为预测。你有什么想法我可以改善我的网络吗? 这是我的网络代码:

input_img = Input(shape=(28, 28, 1))  # adapt this if using `channels_first` image data format

x = Conv2D(32, (3, 3), strides = (2,2),padding='valid')(input_img)
x =BatchNormalization()(x)
x = Activation('relu')(x)
#x = BatchNormalization()(x)
x = Conv2D(16, (3, 3), strides = (2,2),padding='valid')(x)

x =BatchNormalization()(x)
x = Activation('relu')(x)

x = Conv2D(8, (2, 2), strides = (2,2),  padding='valid')(x)
x =BatchNormalization()(x)
encoded = Activation('relu')(x)

x = Conv2D(8, (1, 1), padding='valid')(encoded)
x =BatchNormalization()(x)
x = Activation('relu')(x)
x = UpSampling2D((3, 3))(x)
x = Conv2D(16, (2, 2), padding='valid')(x)
x =BatchNormalization()(x)
x = Activation('relu')(x)
x = UpSampling2D((2, 2))(x)
x = Conv2D(32, (3,3))(x)
x =BatchNormalization()(x)
x = Activation('relu')(x)
x = UpSampling2D((2, 2))(x)

decoded = Conv2D(1, (2, 2), activation='sigmoid', padding='same')(x)

autoencoder = Model(input_img, decoded)
autoencoder.compile(optimizer='adadelta', loss='binary_crossentropy')

如何改善我的网络?任何提示都非常感谢!

干杯, 岸堤

0 个答案:

没有答案