Issue reshaping an array into (28, 28) for an MNIST image

When running this code, I want to show the image in matplotlib but am I getting an error in some_digit_image = some_digit.reshape(28, 28) where I get the ValueError: cannot reshape array of size 1 into shape (28, 28). Is there any way to fix this issue and get the image in the matplotlib. Thanks for… Read More Issue reshaping an array into (28, 28) for an MNIST image

Why do we need to pre-process image datasets?

Refer to this Complete guide on How to use Autoencoders in Python Notice the author add: x_train = x_train.astype(‘float32’) / 255. x_test = x_test.astype(‘float32’) / 255. x_train = x_train.reshape((len(x_train), np.prod(x_train.shape[1:]))) x_test = x_test.reshape((len(x_test), np.prod(x_test.shape[1:]))) after they loaded the MNIST data. Why do they divide the image data by 255? And why 255? After that why… Read More Why do we need to pre-process image datasets?