My cnn model, which is created using Keras 1.1.1, has two convolution-pooling layers followed by two dense layers, and dropout is added following the second convolution-pooling layer and the first dense layer. The codes are as follows:
model = Sequential()
#convolution-pooling layers
model.add(Convolution2D(32, 5, 5, input_shape=input_shape))
model.add(Activation('relu'))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Convolution2D(64, 5, 5))
model.add(Activation('relu'))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Dropout(0.25))
#dense layers
model.add(Flatten())
model.add(Dense(100))
model.add(Activation('relu'))
model.add(Dropout(0.5))
model.add((Dense(2)))
model.add(Activation('softmax'))
#optimizer
sgd = SGD(lr=1e-3, decay=1e-6, momentum=0.9, nesterov=True)
model.compile(loss='categorical_crossentropy',
optimizer = sgd,
metrics=['accuracy'])
print model.summary()
The model summary gives the table as follows:
I am not clear of how the number of parameters of the second convolution layer (i.e., 51264 indicated by the red rectangle) is computed. I thought the number would be (5*5 + 1)*64 = 1664, since the convolution kernel is 5*5 in size and 64 feature maps are to be extracted.
Besides, I have already implemented dropout. Why does the parameter table not reflect this point. It seems the parameter number without dropout is given, although the dropout (layer) is listed in the table. Anyone can help me to interpret the parameter summary?