Add padding to a CNN
Padding allows a convolutional layer to retain the resolution of the input into this layer. This is done by adding zeros around the edges of the input image, so that the convolution kernel can overlap with the pixels on the edge of the image.
Bu egzersiz
Image Modeling with Keras
kursunun bir parçasıdırEgzersiz talimatları
Add a Conv2D layer and choose a padding such that the output has the same size as the input.
Uygulamalı interaktif egzersiz
Bu örnek kodu tamamlayarak bu egzersizi bitirin.
# Initialize the model
model = Sequential()
# Add the convolutional layer
model.add(____(10, kernel_size=3, activation='relu',
input_shape=(img_rows, img_cols, 1),
____))
# Feed into output layer
model.add(Flatten())
model.add(Dense(3, activation='softmax'))