Keras 3 API 文档 / 内置小型数据集 / CIFAR10 小型图像分类数据集

CIFAR10 小型图像分类数据集

[源]

load_data 函数

keras.datasets.cifar10.load_data()

加载 CIFAR10 数据集。

这是一个包含 50,000 张 32x32 彩色训练图像和 10,000 张测试图像的数据集,分为 10 个类别。有关更多信息,请访问 CIFAR 主页

类别如下

标签 描述
0 飞机
1 汽车
2
3
4 鹿
5
6 青蛙
7
8
9 卡车

返回

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

x_train:形状为 (50000, 32, 32, 3)uint8 NumPy 数组,包含训练数据。像素值范围为 0 到 255。

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

x_test:形状为 (10000, 32, 32, 3)uint8 NumPy 数组,包含测试数据。像素值范围为 0 到 255。

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

示例

(x_train, y_train), (x_test, y_test) = keras.datasets.cifar10.load_data()
assert x_train.shape == (50000, 32, 32, 3)
assert x_test.shape == (10000, 32, 32, 3)
assert y_train.shape == (50000, 1)
assert y_test.shape == (10000, 1)