数据集介绍
一、Keras方法
1.读取数据集
MNIST 数据集预先加载在Keras 库中,其中包括4 个Numpy 数组。
from keras.datasets import mnist
(train_images, train_labels), (test_images, test_labels) = mnist.load_data()
2.查看数据集属性
图像被编码为Numpy 数组,而标签是数字数组,取值范围为0~9。图像和标签一一对应。
>>> train_images.shape
(60000, 28, 28)
>>> len(train_labels)
60000
>>> train_labels
array([5, 0, 4, ..., 5, 6, 8], dtype=uint8)
>>> test_images.shape
(10000,