wish of those help I wrote how I fixed the problem in a comment but I want to make it more clear. The problem happened only when the program was lauched from idle AND if it was the first time you would import mnist data from keras.
In which folder on PC (Windows 10) does load_data() save a dataset in Keras?
will be helpful for those in need It is very likely that the images in tensorflow.examples.tutorials.mnist have been normalized to the range [0, 1] and therefore you obtain better results. Whereas, the values in MNIST dataset in Keras are in the range [0, 255] and you are expected to normalize them (if needed, of course). Try this:
fixed the issue. Will look into that further The object np.array was shape l,b,c at this point np_array = np.asarray(img) you then reshaped it with np_array = np_array.reshape(l*b*c,) which is what you didn't want. Just remove those 2 lines Also since you label is always 0 no need to have it append in the loop, just return it.
for filename in os.listdir(path):
img=Image.open(path + filename)
np_array = np.asarray(img)
all_images = np.array(all_images_as_array)
return all_images, np.zeros_like(all_images)