I want to use my drawing for my neural network. I trained it on MNIST. I can’t prepare from any way. I drew a figure in a 28x28 picture resolution. I try to run it through the neural network, but it doesn't work. I don't understand how to fix this problem.
CODE
#norm_image = np.asarray(pixels, dtype=np.float32) / 255
img_size=28
img = cv2.resize(img, (img_size,img_size))
x=img
x=np.asarray(img)
x = img.astype('float32')
x /= 255.0
x = np.expand_dims(x, axis=0)
images = np.vstack([x])
print(images.shape)
images = np.reshape(images,(1, 28, 28))
#print(pixels)
#print(x.shape)
#res=model.predict(x)
#print (res)
#print(f"Распознанная цифра: {np.argmax(res)}")
#x = np.expand_dims(x, axis=0)
#plt.imshow(img, cmap=plt.cm.binary)
#plt.show()
Errore
ValueError Traceback (most recent call last)
<ipython-input-167-3fe66f8f6d63> in <module>()
13 images = np.vstack([x])
14 print(images.shape)
---> 15 images = np.reshape(images,(1, 28, 28))
16
17 #print(pixels)
<__array_function__ internals> in reshape(*args, **kwargs)
1 frames
/usr/local/lib/python3.7/dist-packages/numpy/core/fromnumeric.py in _wrapfunc(obj, method, *args, **kwds)
56
57 try:
---> 58 return bound(*args, **kwds)
59 except TypeError:
60 # A TypeError occurs if the object does have such a method in its
ValueError: cannot reshape array of size 2352 into shape (1,28,28)