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 | 卡車 |
回傳值
(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)