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

CIFAR10 小型图像分类数据集

[来源]

load_data 函数

tf_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)