Creating a deep learning network
A deep convolutional neural network is a network that has more than one layer. Each layer in a deep network receives its input from the preceding layer, with the very first layer receiving its input from the images used as training or test data.
Here, you will create a network that has two convolutional layers.
This exercise is part of the course
Image Modeling with Keras
Exercise instructions
- The first convolutional layer is the input layer of the network. This should have 15 units with kernels of 2 by 2 pixels. It should have a
'relu'
activation function. It can use the variablesimg_rows
andimg_cols
to define itsinput_shape
. - The second convolutional layer receives its inputs from the first layer. It should have 5 units with kernels of 2 by 2 pixels. It should also have a
'relu'
activation function.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
from keras.models import Sequential
from keras.layers import Dense, Conv2D, Flatten
model = Sequential()
# Add a convolutional layer (15 units)
____
# Add another convolutional layer (5 units)
____
# Flatten and feed to output layer
model.add(Flatten())
model.add(Dense(3, activation='softmax'))