當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Python tf.keras.datasets.fashion_mnist.load_data用法及代碼示例

加載 Fashion-MNIST 數據集。

用法

tf.keras.datasets.fashion_mnist.load_data()

返回

  • NumPy 數組元組:(x_train, y_train), (x_test, y_test)

這是一個包含 10 個時尚類別的 60,000 個 28x28 灰度圖像的數據集,以及一個包含 10,000 個圖像的測試集。該數據集可用作 MNIST 的 drop-in 替代品。

這些課程是:

標簽 說明
0 T-shirt/頂部
1 Trouser
2 Pullover
3 Dress
4 Coat
5 Sandal
6 Shirt
7 Sneaker
8 Bag
9 踝靴

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 許可下獲得許可。

相關用法


注:本文由純淨天空篩選整理自tensorflow.org大神的英文原創作品 tf.keras.datasets.fashion_mnist.load_data。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。