Exercise

Keras pooling layers

Keras implements a pooling operation as a layer that can be added to CNNs between other layers. In this exercise, you will construct a convolutional neural network similar to the one you have constructed before:

Convolution => Convolution => Flatten => Dense

However, you will also add a pooling layer. The architecture will add a single max-pooling layer between the convolutional layer and the dense layer with a pooling of 2x2:

Convolution => Max pooling => Convolution => Flatten => Dense

A Sequential model along with Dense, Conv2D, Flatten, and MaxPool2D objects are available in your workspace.

Instructions

100 XP
  • Add an input convolutional layer (15 units, kernel size of 2, relu activation).
  • Add a maximum pooling operation (pooling over windows of size 2x2).
  • Add another convolution layer (5 units, kernel size of 2, relu activation).
  • Flatten the output of the second convolution and add a Dense layer for output (3 categories, softmax activation).