Conv Autoencoder 层级数
Posted
技术标签:
【中文标题】Conv Autoencoder 层级数【英文标题】:Conv Autoencoder layer progression 【发布时间】:2020-10-10 12:08:52 【问题描述】:我想建立一个简单的卷积自动编码器:
层(类型)输出形状参数#
输入(InputLayer) (None, 64, 64, 1) 0
encoder_conv_1 (Conv2D) (None, 64, 64, 32) 320
max_pooling2d_1 (MaxPooling2 (None, 32, 32, 32) 0
decoder_conv_1 (Conv2D) (None, 30, 30, 32) 9248
up_sampling2d_1 (UpSampling2 (None, 60, 60, 32) 0
输出(Conv2D)(无、60、60、1)289
为什么我的最后一层没有回到 64, 64 ,1?或者更确切地说,为什么decoder_conv_1层会到30、30、32?
【问题讨论】:
【参考方案1】:你错过了同样的填充。试试这种方式...
inp = Input((64,64,1))
c = Conv2D(32, 3, padding='same')(inp)
c = MaxPool2D()(c)
c = Conv2D(32, 3, padding='same')(c) # <=== padding same
c = UpSampling2D()(c)
out = Conv2D(1, 3, padding='same')(c)
m = Model(inp, out)
m.summary()
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
input_5 (InputLayer) [(None, 64, 64, 1)] 0
_________________________________________________________________
conv2d_8 (Conv2D) (None, 64, 64, 32) 320
_________________________________________________________________
max_pooling2d_3 (MaxPooling2 (None, 32, 32, 32) 0
_________________________________________________________________
conv2d_9 (Conv2D) (None, 32, 32, 32) 9248
_________________________________________________________________
up_sampling2d_2 (UpSampling2 (None, 64, 64, 32) 0
_________________________________________________________________
conv2d_10 (Conv2D) (None, 64, 64, 1) 289
=================================================================
【讨论】:
这解决了它。不知道为什么我在最后一层缺少填充属性。谢谢。以上是关于Conv Autoencoder 层级数的主要内容,如果未能解决你的问题,请参考以下文章
自动编码器:层“model_3”需要 1 个输入,但它接收到 64 个输入张量