Aan de slagGa gratis aan de slag

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.

Deze oefening maakt deel uit van de cursus

Image Modeling with Keras

Cursus bekijken

Oefeninstructies

Construct a neural network with a Conv2D layer with strided convolutions that skips every other pixel.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# 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'))
Code bewerken en uitvoeren