Valueerror: Cannot Reshape Array Of Size 784 Into Shape (16,16)
While read .mat format data with Python and show as plt: import scipy.io as spio import numpy as np import matplotlib.pyplot as plt digits = spio.loadmat('./data/digits.mat', sque
Solution 1:
Of course, the solution is easier than you think.
ValueError: cannot reshape array of size 784 into shape (16,16).
28 x 28 = 784
Therefore, you need to reshape into the format (28,28)
rather than (16,16)
Solution 2:
I had similar problems but not with images, it looks similar in a way, so here is how I did mine. You might need to resize the data first: the data in the code below is your size =784, you do not necessarily need to abandon your shape
datas= np.array([data], order='C')
datas.resize((16,16))
datas.shape
Post a Comment for "Valueerror: Cannot Reshape Array Of Size 784 Into Shape (16,16)"