Keras 中最大池化层的默认池化大小是多少?
What is the default pooling size of Max pooling layers in Keras?
Keras 中最大池化层的默认池化大小是多少?
池化层有 3 个参数:pool_size、步幅和填充。如果 pool_size 没有明确指定,Keras 默认使用什么 pool_size 值?
例如在下面的keras池化层中,就是pool_size?
model.add(tf.keras.layers.MaxPooling2D(strides=(2,2), padding='same'))
Keras 中的默认值与在带有 Keras 后端的 Tensorflow 中一样是 pool_size=(2,2)
,因此它将输入的 x
和 y
空间维度减半。
Here you can see the documentation in Tensorflow where it is mentioned.
更具体地说,stride
和 pool_size
参数高度相关,只有当您更改填充类型时才会有所不同。如文档中所述:
output_shape = math.floor((input_shape - pool_size) / strides) + 1
在 input_shape >= pool_size
的情况下 如果选择的填充是 valid
.
否则,如果选择的填充是same
:
output_shape = math.floor((input_shape - 1) / strides) + 1
Keras 中最大池化层的默认池化大小是多少? 池化层有 3 个参数:pool_size、步幅和填充。如果 pool_size 没有明确指定,Keras 默认使用什么 pool_size 值?
例如在下面的keras池化层中,就是pool_size?
model.add(tf.keras.layers.MaxPooling2D(strides=(2,2), padding='same'))
Keras 中的默认值与在带有 Keras 后端的 Tensorflow 中一样是 pool_size=(2,2)
,因此它将输入的 x
和 y
空间维度减半。
Here you can see the documentation in Tensorflow where it is mentioned.
更具体地说,stride
和 pool_size
参数高度相关,只有当您更改填充类型时才会有所不同。如文档中所述:
output_shape = math.floor((input_shape - pool_size) / strides) + 1
在 input_shape >= pool_size
的情况下 如果选择的填充是 valid
.
否则,如果选择的填充是same
:
output_shape = math.floor((input_shape - 1) / strides) + 1