load_data
函式keras.datasets.fashion_mnist.load_data()
載入 Fashion-MNIST 資料集。
這是一個包含 60,000 張 28x28 像素灰階圖像(共 10 種服裝類別)的資料集,以及包含 10,000 張圖像的測試集。此資料集可作為 MNIST 的直接替代方案。
類別如下
標籤 | 描述 |
---|---|
0 | T 恤/上衣 |
1 | 長褲 |
2 | 套頭衫 |
3 | 洋裝 |
4 | 外套 |
5 | 涼鞋 |
6 | 襯衫 |
7 | 運動鞋 |
8 | 包包 |
9 | 踝靴 |
回傳值
NumPy 陣列的元組:(x_train, y_train), (x_test, y_test)
。
x_train
:uint8
NumPy 陣列,包含灰階圖像資料,形狀為 (60000, 28, 28)
,包含訓練資料。
y_train
:uint8
NumPy 陣列,包含標籤(範圍 0-9 的整數),形狀為 (60000,)
,用於訓練資料。
x_test
:uint8
NumPy 陣列,包含灰階圖像資料,形狀為 (10000, 28, 28),包含測試資料。
y_test
:uint8
NumPy 陣列,包含標籤(範圍 0-9 的整數),形狀為 (10000,)
,用於測試資料。
範例
(x_train, y_train), (x_test, y_test) = fashion_mnist.load_data()
assert x_train.shape == (60000, 28, 28)
assert x_test.shape == (10000, 28, 28)
assert y_train.shape == (60000,)
assert y_test.shape == (10000,)
授權條款
Fashion-MNIST 的著作權由 Zalando SE 持有。Fashion-MNIST 依照 MIT 授權條款授權。