"""注意:
mnist数据集中图像的存储形状为28*28的灰度图像即一维
plt.imshow显示为二维图像,故需要将一维数组更改为二维数组
而且要针对对应的那个图像进行形状更改
"""
print(train_images[4].shape)
train_images_4 = train_images[4].reshape(28, 28)
print(train_images_4.shape)
plt.imshow(train_images_4, cmap=plt.cm.binary)
plt.show()
keras实现MNIST数据集的第4个图像显示——ValueError: cannot reshape array of size 47040000 into shape (6000,28,28)
最新推荐文章于 2023-09-04 10:47:49 发布