Import image into Tensorflow model
By default, the image is loaded as a color Image i.e. 784*3 = 2352

Load image as grayscale i.e. use parameter color_mode=&quot;grayscale&quot;
No need to of np.vstack(), simply reshape to (-1,784)