Keras 2 API文档 / 内置小型数据集 / Fashion MNIST数据集,MNIST的替代品

Fashion MNIST 数据集,MNIST 的替代品

[源代码]

load_data 函数

tf_keras.datasets.fashion_mnist.load_data(cache_dir=None)

加载Fashion-MNIST数据集。

这是一个包含60,000个28x28灰度图像的数据集,涵盖10种时尚类别,另有10,000个图像的测试集。该数据集可直接替换MNIST。

类别如下

标签 描述
0 T恤/上衣
1 长裤
2 套头衫
3 连衣裙
4 外套
5 凉鞋
6 衬衫
7 运动鞋
8
9 踝靴

参数

  • cache_dir: 用于在本地缓存数据集的目录。如果为None,则默认为~/.keras/datasets

返回

  • NumPy 数组元组(x_train, y_train), (x_test, y_test)

x_train: 形状为(60000, 28, 28)的uint8 NumPy数组,包含灰度图像数据,是训练数据。

y_train: 形状为(60000,)的uint8 NumPy数组,包含训练数据的标签(0-9范围内的整数)。

x_test: 形状为(10000, 28, 28)的uint8 NumPy数组,包含灰度图像数据,是测试数据。

y_test: 形状为(10000,)的uint8 NumPy数组,包含测试数据的标签(0-9范围内的整数)。

示例

(x_train, y_train), (x_test, y_test) = fashion_mnist.load_data()
assert x_train.shape == (60000, 28, 28)
assert x_test.shape == (10000, 28, 28)
assert y_train.shape == (60000,)
assert y_test.shape == (10000,)

许可证:Fashion-MNIST的版权归Zalando SE所有。Fashion-MNIST根据MIT许可证授权。