title: ValueError: cannot reshape array of size 4096 into shape (64,64,3)
body: <p>Hi stack overflow friends :)<br />
  I trained a CNN model for predicting number images.<br />
  Learned it successfully And I want to predict a number from an image in which several numbers.<br />
  But I got an error.<br />
  I'll show you my dataset and some of my code.</p>
  <p><strong>Dataset.py</strong></p>
  <pre><code>batch_size = 32
  img_height = 64
  img_width = 64  
  
  train_ds = tf.keras.preprocessing.image_dataset_from_directory(
  data_dir,
  validation_split=0.2,
  subset=&quot;training&quot;,
  seed=123,
  image_size=(img_height, img_width),
  batch_size=batch_size)
  </code></pre>
  <p><strong>Model.py</strong></p>
  <pre><code>num_classes = 10
  
  model = Sequential([
    layers.experimental.preprocessing.Rescaling(1./255, input_shape=(img_height, img_width, 3)),
    layers.Conv2D(16, 3, padding='same', activation='relu'),
    layers.MaxPooling2D(),
    layers.Conv2D(32, 3, padding='same', activation='relu'),
    layers.MaxPooling2D(),
    layers.Conv2D(64, 3, padding='same', activation='relu'),
    layers.MaxPooling2D(),
    layers.Flatten(),
    layers.Dense(128, activation='relu'),
    layers.Dense(num_classes)
  ])
  
  model.compile(optimizer='adam',
                loss=tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True),
                metrics=['accuracy'])
  </code></pre>
  <p><strong>Predict Several Numbers.py</strong></p>
  <pre><code>import cv2 as cv
  import numpy as np
  from tensorflow.keras.models import load_model
  
  img_color = cv.imread('mypath/test.PNG', cv.IMREAD_COLOR)
  img_gray = cv.cvtColor(img_color, cv.COLOR_BGR2GRAY)
  
  ret,img_binary = cv.threshold(img_gray, 0, 255, cv.THRESH_BINARY_INV | cv.THRESH_OTSU)
  kernel = cv.getStructuringElement( cv.MORPH_RECT, ( 5, 5 ) )
  img_binary = cv.morphologyEx(img_binary, cv. MORPH_CLOSE, kernel)
  
  contours, hierarchy = cv.findContours(img_binary, cv.RETR_EXTERNAL, 
                      cv.CHAIN_APPROX_SIMPLE)
  
  for contour in contours:
      x, y, w, h = cv.boundingRect(contour)
      length = max(w, h) + 60
      img_digit = np.zeros((length, length, 1),np.uint8)
      new_x,new_y = x-(length - w)//2, y-(length - h)//2
      img_digit = img_binary[new_y:new_y+length, new_x:new_x+length]
  
      model = load_model('mypath/saved_model.h5')
  
      img_digit = cv.resize(img_digit,(64,64), interpolation=cv.INTER_AREA)
  
      img_digit = img_digit / 255.0
  
      img_input = np.array(img_digit).reshape(-1,64,64,3)
  
      predictions = model.predict(img_input)
      number = np.argmax(predictions)
      print(number)
  
      cv.rectangle(img_color, (x, y), (x+w, y+h), (255, 255, 0), 2)
  
      location = (x + int(w *0.5), y - 10)
      font = cv.FONT_HERSHEY_COMPLEX  
      fontScale = 1.2
      cv.putText(img_color, str(number), location, font, fontScale, (0,255,0), 2)
  
  
      cv.imshow('digit', img_digit)
      cv.waitKey(0)
  </code></pre>
  <p>I think it's the perfect code. but I got error :(</p>
  <blockquote>
  <p>ValueError: cannot reshape array of size 4096 into shape (64,64,3)</p>
  </blockquote>
  <p>Why I getting this error? Help me!!!</p>