reshape an array of images

前端 未结 3 946
陌清茗
陌清茗 2021-01-19 06:15

I have 60000 train_images brought in as a shape (28,28,60000) matrix. It is a numpy.ndarray. I want to convert it to an array of 1 dimensional images, meaning each image is

3条回答
  •  悲哀的现实
    2021-01-19 06:27

    I think you just need to use reshape:

    >>> images = np.ndarray([60000, 28, 28])
    >>> images.shape
    (60000, 28, 28)
    >>> images_rs = images.reshape([60000, 28*28])
    >>> images_rs.shape
    (60000, 784)
    

提交回复
热议问题