简单的自动编码器在许多时期后不会收敛

时间:2019-03-22 07:31:58

标签: tensorflow keras deep-learning autoencoder

我正在为CIFA10数据集开发一种自动编码器,而不会在输入端添加噪声(这是第二个目标)。

基于Convnet的自动编码器未收敛:任何建议

input_img=Input(shape=(32,32,3))



x=Conv2D(16,(3,3),padding='same',activation='relu')(input_img)

x=MaxPooling2D((2,2),padding='same')(x)

x=Conv2D(8,(3,3),padding='same',activation='relu')(x)

x=MaxPooling2D((2,2),padding='same')(x)

x=Conv2D(8,(3,3),padding='same',activation='relu')(x)

encoded=MaxPooling2D((2,2),padding='same')(x)
x=Conv2D(8,(3,3),padding='same',activation='relu')(encoded)

x=UpSampling2D((2,2))(x)

x=Conv2D(8,(3,3),padding='same',activation='relu')(x)

x=UpSampling2D((2,2))(x)
x=Conv2D(16,(3,3),padding='same',activation='relu')(x) 
x=UpSampling2D((2,2))(x)
decoded=Conv2D(3,(3,3),padding='same',activation='sigmoid')(x)
autoencoder=Model(input_img,decoded)
(x_train,_),(x_test,_)=cifar10.load_data()

x_train=x_train.astype('float32')/255

x_test=x_test.astype('float32')/255

x_train=x_train.reshape(len(x_train),32,32,3)

x_test=x_test.reshape(len(x_test),32,32,3)



autoencoder.compile(optimizer='Adam',loss='binary_crossentropy')
autoencoder.fit(x_train, x_train,

            epochs=50,
            batch_size=64,
            shuffle=True,
            validation_data=(x_test, x_test))

即使是大纪元,我也会感到迷茫

我尝试将模型64-32-16-8:8-16-32-64与CIFAR-10的灰度图像一起使用,但是我仍然遇到相同的收敛问题,网络会给出模糊输出,如图所示{{ 3}}

1 个答案:

答案 0 :(得分:1)

不确定您的意思。如果我是您,我会尝试更深入的模型以获得更好的性能。例如,该模型提出了波纹管(甚至更深层次的波纹管)

input_img=Input(shape=(32,32,3))

x=Conv2D(8,(3,3),padding='same',activation='relu')(input_img)
x=Conv2D(8,(3,3),padding='same',activation='relu')(x)

x=MaxPooling2D((2,2),padding='same')(x)

x=Conv2D(16,(3,3),padding='same',activation='relu')(x)
x=Conv2D(16,(3,3),padding='same',activation='relu')(x)

x=MaxPooling2D((2,2),padding='same')(x)

x=Conv2D(32,(3,3),padding='same',activation='relu')(x)
x=Conv2D(32,(3,3),padding='same',activation='relu')(x)

encoded=MaxPooling2D((2,2),padding='same')(x)
x=Conv2D(32,(3,3),padding='same',activation='relu')(encoded)
x=Conv2D(32,(3,3),padding='same',activation='relu')(x)

x=UpSampling2D((2,2))(x)

x=Conv2D(16,(3,3),padding='same',activation='relu')(x)
x=Conv2D(16,(3,3),padding='same',activation='relu')(x)

x=UpSampling2D((2,2))(x)
x=Conv2D(8,(3,3),padding='same',activation='relu')(x) 
x=Conv2D(8,(3,3),padding='same',activation='relu')(x) 
x=UpSampling2D((2,2))(x)
decoded=Conv2D(3,(3,3),padding='same',activation='sigmoid')(x)
autoencoder=Model(input_img,decoded)