import keras
from keras.datasets import mnist
(train_images, train_labels), (test_images, test_labels) = mnist.load_data()
I have just loaded the mnist library for giving example.
If we see the shape of the train_images.
train_images.shape
> (60000, 28, 28)
So its a 3D array where we have 60000 images with 28×28 shaped images. We can convert this 28×28 2D images to 1D images of 784(28×28).
train_images = train_images.reshape((60000, 28 * 28))
train_images.shape
> (60000, 784)
Hope it helped.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…