我有一个AutoEncoder
的模型,如下所示:
height, width = 28, 28
input_img = Input(shape=(height * width,))
encoding_dim = height * width//256
x = Dense(height * width, activation='relu')(input_img)
encoded1 = Dense(height * width//2, activation='relu')(x)
encoded2 = Dense(height * width//8, activation='relu')(encoded1)
y = Dense(encoding_dim, activation='relu')(encoded2)
decoded2 = Dense(height * width//8, activation='relu')(y)
decoded1 = Dense(height * width//2, activation='relu')(decoded2)
z = Dense(height * width, activation='sigmoid')(decoded1)
autoencoder = Model(input_img, z)
#encoder is the model of the autoencoder slice in the middle
encoder = Model(input_img, y)
decoder = Model(y, z)
print(encoder)
print(decoder)
编码器部分使用上述代码进行检索,但是我无法使用上面添加的代码获取解码器部分:
我收到以下错误:
^{pr2}$你能告诉我怎么得到那部分吗?在
decoder
模型需要有一个输入层。例如,这里的decoder_input
:相关问题 更多 >
编程相关推荐