作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在经过时the autoencoder tutorial in Keras blog ,看到作者在Convolutional Autoencoder部分的max pooling layer使用了相同的padding,如下图。
x = MaxPooling2D((2, 2), padding='same')(x)
最佳答案
来自 https://keras.io/layers/convolutional/
"same" results in padding the input such that the output has the same length as the original input.
pool_size: integer or tuple of 2 integers, factors by which to downscale (vertical, horizontal). (2, 2) will halve the input in both spatial dimension. If only one integer is specified, the same window length will be used for both dimensions.
input_img = Input(shape=(28, 28, 1)) # adapt this if using `channels_first` image data format
x = Conv2D(16, (3, 3), activation='relu', padding='same')(input_img)
x = MaxPooling2D((2, 2), padding='same')(x)
x = Conv2D(8, (3, 3), activation='relu', padding='same')(x)
x = MaxPooling2D((2, 2), padding='same')(x)
x = Conv2D(8, (3, 3), activation='relu', padding='same')(x)
encoded = MaxPooling2D((2, 2), padding='same')(x)
# at this point the representation is (4, 4, 8) i.e. 128-dimensional
关于keras - 为什么在最大池化中使用相同的填充?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54316717/
我是一名优秀的程序员,十分优秀!