什么是"相同"和"有效"填充之间的区别tf.nn.max_pool的tensorflow?
在我看来,'VALID'意味着当我们做最大池时,边缘外没有零填充.
根据深度学习的卷积算法指南,它表示池操作符中没有填充,即只使用'VALID' tensorflow.但是什么是最大池的"相同"填充tensorflow?
我正在尝试将以下 Keras 模型代码转换为 pytorch,但在处理 padding='same' 时遇到问题。
model = Sequential()
model.add(Conv2D(64, (3, 3), input_shape=img_size))
model.add(BatchNormalization(axis=1))
model.add(Activation('relu'))
model.add(Dropout(0.3))
model.add(Conv2D(64, (3, 3), padding='same'))
model.add(BatchNormalization(axis=1))
model.add(Activation('relu'))
model.add(MaxPooling2D(pool_size=(2,2), strides=(2,2), padding='same'))
Run Code Online (Sandbox Code Playgroud)
这产生以下摘要:
Layer (type) Output Shape Param #
=================================================================
conv2d_1 (Conv2D) (None, 30, 30, 64) 1792
_________________________________________________________________
batch_normalization_1 (Batch (None, 30, 30, 64) 120
_________________________________________________________________
activation_1 (Activation) (None, 30, 30, 64) 0
_________________________________________________________________
dropout_1 (Dropout) (None, 30, 30, 64) 0
_________________________________________________________________
conv2d_2 (Conv2D) (None, 30, 30, 64) 36928
_________________________________________________________________
batch_normalization_2 (Batch (None, 30, 30, 64) 120 …Run Code Online (Sandbox Code Playgroud)