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 | 踝靴 |
参数
~/.keras/datasets。返回
(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许可证授权。