我从 keras 导入了 minst 数据集,并希望显示其中的一些图像。但是由于我内部从keras导入数据集,我应该如何使用matplotlib来显示一些图像?
%matplotlib inline
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
# this creates a training set and test set
(x_train, y_train), (x_test, y_test) = mnist.load_data()
img=mpimg.imread('x_train[1]')
imgplot = plt.imshow(img)
plt.show()
最佳答案
你可以这样做
import matplotlib.pyplot as plt
image=x_train[1]
plt.imshow(image)
plt.show()
关于python - 如何在keras中使用MNIST数据集显示图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50230222/