load_data
函數keras.datasets.cifar100.load_data(label_mode="fine")
載入 CIFAR100 資料集。
這是一個包含 50,000 張 32x32 彩色訓練圖像和 10,000 張測試圖像的資料集,這些圖像標記了 100 個細粒度類別,這些類別又被分組為 20 個粗粒度類別。請參閱 CIFAR 首頁 以獲得更多資訊。
參數
"fine"
或 "coarse"
其中之一。如果為 "fine"
,則類別標籤為細粒度標籤;如果為 "coarse"
,則輸出標籤為粗粒度超類別。返回值
(x_train, y_train), (x_test, y_test)
。x_train
:uint8
NumPy 陣列,包含灰階圖像資料,形狀為 (50000, 32, 32, 3)
,包含訓練資料。像素值範圍從 0 到 255。
y_train
:uint8
NumPy 陣列,包含標籤 (範圍 0-99 的整數),形狀為 (50000, 1)
,用於訓練資料。
x_test
:uint8
NumPy 陣列,包含灰階圖像資料,形狀為 (10000, 32, 32, 3)
,包含測試資料。像素值範圍從 0 到 255。
y_test
:uint8
NumPy 陣列,包含標籤 (範圍 0-99 的整數),形狀為 (10000, 1)
,用於測試資料。
範例
(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)