In the get_data function, I keep getting different variations of the error “ValueError: cannot reshape array of size 1 into shape (28,28)”
If I try reshape outside the for loop, it gives me the same message with the file size instead.
I am totally lost on how to solve this… please help! Code below.
with open(filename) as training_file:
imgs = []
labels = []
next(training_file, None)
for row in training_file:
label = row[0]
data = row[1:]
img = np.array(data).reshape((28, 28))
imgs.append(img)
labels.append(label)
images = np.array(imgs).astype(float)
labels = np.array(labels).astype(float)
return images, labels