Add strides to a convolutional network
The size of the strides of the convolution kernel determines whether the kernel will skip over some of the pixels as it slides along the image. This affects the size of the output because when strides are larger than one, the kernel will be centered on only some of the pixels.
This exercise is part of the course
Image Modeling with Keras
Exercise instructions
Construct a neural network with a Conv2D
layer with strided convolutions that skips every other pixel.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Initialize the model
model = Sequential()
# Add the convolutional layer
model.add(Conv2D(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'))