title: Keras CNN model parameters calculation
body: <p>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:</p>
  
  <pre class="lang-py prettyprint-override"><code>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()
  </code></pre>
  
  <p>The model summary gives the table as follows:</p>
  
  <p><a href="https://i.stack.imgur.com/2sj2X.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2sj2X.png" alt="enter image description here"></a></p>
  
  <p>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. </p>
  
  <p>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?</p>