load_data functionkeras.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: uint8 NumPy数组,包含灰度图像数据,形状为(50000, 32, 32, 3),包含训练数据.像素值范围从0到255.
y_train: uint8 NumPy数组,包含标签(范围0-9的整数),形状为(50000, 1),用于训练数据.
x_test: uint8 NumPy数组,包含灰度图像数据,形状为(10000, 32, 32, 3),包含测试数据.像素值范围从0到255.
y_test: uint8 NumPy数组,包含标签(范围0-9的整数),形状为(10000, 1),用于测试数据.
示例:
(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)