title: Tensorflow, expected conv2d_input to have 4 dimensions
body: <p>I'm using <code>tf.keras</code> and I'm getting following error:</p>
  
  <blockquote>
    <p>ValueError: Error when checking input: expected conv2d_input to have 4 dimensions, but got array with shape (24946, 50, 50)</p>
  </blockquote>
  
  <p>Could someone help me with it?</p>
  
  <p>Code (Image_Size is: <code>50x50</code>)</p>
  
  <pre class="lang-py prettyprint-override"><code>import tensorflow as tf
  import numpy as np
  import pickle
  from tensorflow.keras.models import Sequential
  from tensorflow.keras.layers import Dense, Dropout, Activation, Flatten, Conv2D, MaxPooling2D
  
  
  pickle_ind = open("x.pickle", "rb")
  x = pickle.load(pickle_ind)
  x = np.array(x, dtype=float)
  # x = x/255.0
  
  pickle_ind = open("y.pickle", "rb")
  y = pickle.load(pickle_ind)
  
  n_batch = len(x)
  
  model = Sequential()
  model.add(Conv2D(32, (3, 3), activation='relu', input_shape=(50, 50, 1)))
  model.add(MaxPooling2D((2, 2)))
  model.add(Conv2D(64, (3, 3), activation='relu'))
  model.add(MaxPooling2D((2, 2)))
  model.add(Conv2D(64, (3, 3), activation='relu'))
  
  model.summary()
  
  model.compile(optimizer='adam',
                loss='binary_crossentropy',
                metrics=['accuracy'])
  
  model.fit(x, y, epochs=20, batch_size=n_batch)
  </code></pre>