load_data
函数tf_keras.datasets.cifar100.load_data(label_mode="fine", cache_dir=None)
加载 CIFAR100 数据集。
这是一个包含 50,000 张 32x32 彩色训练图像和 10,000 张测试图像的数据集,这些图像标记了 100 个细粒度类别,这些类别又被分组到 20 个粗粒度类别中。更多信息请参阅 CIFAR 主页。
参数
~/.keras/datasets
。返回值
(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-99 范围内的整数),用于训练数据。
x_test:形状为 (10000, 32, 32, 3)
的 uint8 NumPy 图像数据数组,包含测试数据。像素值范围从 0 到 255。
y_test:形状为 (10000, 1)
的 uint8 NumPy 标签数组(0-99 范围内的整数),用于测试数据。
示例
(x_train, y_train), (x_test, y_test) = keras.datasets.cifar100.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)