1
我已經訓練了以下的自動編碼模式:如何分別使用keen中的自動編碼器的編碼器?
input_img = Input(shape=(1, 32, 32))
x = Convolution2D(16, 3, 3, activation='relu', border_mode='same')(input_img)
x = MaxPooling2D((2, 2), border_mode='same')(x)
x = Convolution2D(8, 3, 3, activation='relu', border_mode='same')(x)
x = MaxPooling2D((2, 2), border_mode='same')(x)
x = Convolution2D(8, 3, 3, activation='relu', border_mode='same')(x)
encoded = MaxPooling2D((2, 2), border_mode='same')(x)
x = Convolution2D(8, 3, 3, activation='relu', border_mode='same')(encoded)
x = UpSampling2D((2, 2))(x)
x = Convolution2D(8, 3, 3, activation='relu', border_mode='same')(x)
x = UpSampling2D((2, 2))(x)
x = Convolution2D(16, 3, 3, activation='relu',border_mode='same')(x)
x = UpSampling2D((2, 2))(x)
decoded = Convolution2D(1, 3, 3, activation='sigmoid', border_mode='same')(x)
autoencoder = Model(input_img, decoded)
autoencoder.compile(optimizer='RMSprop', loss='binary_crossentropy')
autoencoder.fit(X_train, X_train,
nb_epoch=1,
batch_size=128,
shuffle=True,
validation_data=(X_test, X_test)]
)
訓練這個自動編碼器我想用訓練有素的編碼器以用於監督行之後。我如何才能提取此自動編碼器模型的訓練編碼器部分?
非常感謝你 – Codehead