I trained a model for Digit Recognizer (https://www.kaggle.com/c/digit-recognizer/data). The input data is a csv file. Each row in the file represent an image which is 28 pixels in height and 28 pixels in width, for a total of 784 pixels in total. The model is ready to use but I wonder how I can create a testing data for this input? If I have an image with digital number, how can I convert it to 28 by 28 pixels in an array format.
I tried below code but it renders the image background as yellow color. The png image has white background so I don't understand why it shows yellow.
import numpy as np
import cv2
import csv
import matplotlib.pyplot as plt
img = cv2.imread('./test.png', 0) # load grayscale image. Shape (28,28)
flattened = img.flatten() # flatten the image, new shape (784,)
row = flattened.reshape(28,28)
plt.imshow(row)
plt.show()