load_data
函数tf_keras.datasets.fashion_mnist.load_data()
加载 Fashion-MNIST 数据集。
这是一个包含 60,000 张 28x28 灰度图像的 10 个时尚类别数据集,以及一个包含 10,000 张图像的测试集。此数据集可以用作 MNIST 的替代方案。
类别如下:
标签 | 描述 |
---|---|
0 | T恤/上衣 |
1 | 裤子 |
2 | 套衫 |
3 | 连衣裙 |
4 | 外套 |
5 | 凉鞋 |
6 | 衬衫 |
7 | 运动鞋 |
8 | 包 |
9 | 踝靴 |
返回值
(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 许可证 授权。