我正在开发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的灰度图像,但我仍然存在相同的收敛问题,网络给出了模糊输出以及显示的输出网络模糊
不确定您的意思。如果我是您,我会尝试更深入的模型以提高性能。例如,模型提出的波纹管(或更深层)
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)