I'm following the tutorial for deep autoencoders in keras here.
For the simple autoencoder in the beginning there is a decoder
defined like this:
# retrieve the last layer of the autoencoder model
decoder_layer = autoencoder.layers[-1]
# create the decoder model
decoder = Model(encoded_input, decoder_layer(encoded_input))
This doesn't work anymore if you have more than one decoder layer. How to do similar if I have three decoder layers?
encoded = Dense(128, activation='relu')(input_img)
encoded = Dense(64, activation='relu')(encoded)
encoded = Dense(32, activation='relu')(encoded)
decoded = Dense(64, activation='relu')(encoded)
decoded = Dense(128, activation='relu')(decoded)
decoded = Dense(784, activation='sigmoid')(decoded)
autoencoder = Model(input_img, decoded)
encoder = Model(input_img, encoded)
For encoder it does work easily, but how to get a model of the last three layers?