title: What are the causes and possible solutions to always same binary class prediction in Convolutional Neural Network using Keras?
body: <p>Im trying to solve a signature recognition problem. Im using GPDS database and I merged all the combinations of Genuine and Forgery signatures that resulted in a 4 million inputs of 200x200 pixel image. </p>
  
  <p>I created a basic CNN using Keras and, due to the limitations of my hardware, Im using just around 5000 inputs and a maximum of 10 epochs for training. My problem is that, when I start training the model (model.fit command), my accuracy varies around the 50% which is the balance of my dataset and when the epoch finishes, the accuracy is exactly 50%. When I try to predict some results after training, the predictions are all the same (all 1s which means genuine signature, for example). </p>
  
  <p>Not sure if it is a problem of:</p>
  
  <ul>
  <li>Local minima</li>
  <li>Small dataset for the complexity of the problem</li>
  <li>Wrong initialization values for weights, learning rate, momentum…</li>
  <li>Not enough training</li>
  <li>Network pretty simple for the problem</li>
  </ul>
  
  <p>Im new in working with Neural Networks so maybe it is just basic problem, anyway, could anyone help me??</p>
  
  <p>Code is below:</p>
  
  <pre><code>model = Sequential()
  model.add(Conv2D(100, (5, 5), input_shape=(1, 200, 200), activation='relu', data_format='channels_first'))
  model.add(MaxPooling2D(pool_size=(2, 2)))
  model.add(Dropout(0.2))
  model.add(Flatten())
  model.add(Dense(128, activation='relu'))
  model.add(Dense(1, activation='sigmoid'))
  model.compile(loss='binary_crossentropy', optimizer=’adam’, metrics=['accuracy'])
  model.fit(x = x, y = y, batch_size = 100, shuffle = True, epochs=10)
  </code></pre>