title: Getting error: Cannot reshape array of size 122304 into shape (52,28,28)
body: <p>I'm trying to reshape a numpy array as:</p>
  
  <pre><code>data3 = data3.reshape((data3.shape[0], 28, 28))
  </code></pre>
  
  <p>where <code>data3</code> is:</p>
  
  <pre><code>[[54 68 66 ..., 83 72 58]
   [63 63 63 ..., 51 51 51]
   [41 45 80 ..., 44 46 81]
   ..., 
   [58 60 61 ..., 75 75 81]
   [56 58 59 ..., 72 75 80]
   [ 4  4  4 ...,  8  8  8]]
  </code></pre>
  
  <p><code>data3.shape</code> is <code>(52, 2352 )</code></p>
  
  <p>But I keep getting the following error:</p>
  
  <pre><code>ValueError: cannot reshape array of size 122304 into shape (52,28,28)
  Exception TypeError: TypeError("'NoneType' object is not callable",) in &lt;function _remove at 0x10b6477d0&gt; ignored
  </code></pre>
  
  <p>What is happening and how to fix this error?</p>
  
  <p>UPDATE:</p>
  
  <p>I'm doing this to obtain <code>data3</code> that is being used above:</p>
  
  <pre><code>def image_to_feature_vector(image, size=(28, 28)):
  
      return cv2.resize(image, size).flatten()
  
  data3 = np.array([image_to_feature_vector(cv2.imread(imagePath)) for imagePath in imagePaths])  
  </code></pre>
  
  <p>imagePaths contains paths to all the images in my dataset. I actually want to convert the data3 to a <code>flat list of 784-dim vectors</code>, however the </p>
  
  <pre><code>image_to_feature_vector 
  </code></pre>
  
  <p>function converts it to a 3072-dim vector!!</p>