title: How to pass input to 2D Conv in Keras?
body: <p>I have converted voice to spectrogram using librosa. The shape of spectogram is (257, 356), which i have reshaped to (257, 356, 1).</p>
  
  <p>I have created a model </p>
  
  <pre><code>from keras.models import Sequential
  from keras.layers import Dense, Conv2D, Flatten
  model = Sequential()
  model.add(Conv2D(64, kernel_size=3, activation='relu', input_shape=A.shape))
  model.add(Flatten())
  model.add(Dense(1, activation='softmax'))
  </code></pre>
  
  <p>while fitting the model, following error is produced</p>
  
  <pre><code>model.fit(A,validation_data=(A2), epochs=3)
  </code></pre>
  
  <p>where A2 is another spectrogram with following dimensions</p>
  
  <pre><code>ValueError: Error when checking input: expected conv2d_3_input to have 4 dimensions, but got array with shape (257, 356, 1)
  </code></pre>
  
  <p>Model Summary</p>
  
  <pre><code>_________________________________________________________________
  Layer (type)                 Output Shape              Param #   
  =================================================================
  conv2d_24 (Conv2D)           (None, 255, 354, 64)      640       
  _________________________________________________________________
  conv2d_25 (Conv2D)           (None, 253, 352, 32)      18464     
  _________________________________________________________________
  flatten_11 (Flatten)         (None, 2849792)           0         
  _________________________________________________________________
  dense_11 (Dense)             (None, 10)                28497930  
  =================================================================
  Total params: 28,517,034
  Trainable params: 28,517,034
  Non-trainable params: 0
  </code></pre>
  
  <p><strong>And the shape of A[0] is</strong></p>
  
  <pre><code>A[0].shape = (356, 1)
  </code></pre>