load_data
函數keras.datasets.mnist.load_data(path="mnist.npz")
載入 MNIST 資料集。
這是一個包含 60,000 張 28x28 灰度圖像(代表 10 個數字)的資料集,以及一個包含 10,000 張圖像的測試集。更多資訊請參閱 MNIST 首頁。
引數
~/.keras/datasets
)。返回
(x_train, y_train), (x_test, y_test)
。x_train
:uint8
NumPy 陣列,包含灰度圖像資料,形狀為 (60000, 28, 28)
,包含訓練資料。像素值範圍從 0 到 255。
y_train
:uint8
NumPy 陣列,包含數字標籤(範圍 0-9 的整數),形狀為 (60000,)
,用於訓練資料。
x_test
:uint8
NumPy 陣列,包含灰度圖像資料,形狀為 (10000, 28, 28)
,包含測試資料。像素值範圍從 0 到 255。
y_test
:uint8
NumPy 陣列,包含數字標籤(範圍 0-9 的整數),形狀為 (10000,)
,用於測試資料。
範例
(x_train, y_train), (x_test, y_test) = keras.datasets.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,)
授權條款
Yann LeCun 和 Corinna Cortes 擁有 MNIST 資料集的著作權,該資料集是衍生自原始 NIST 資料集的作品。MNIST 資料集依照 創用 CC 姓名標示-相同方式分享 3.0 授權條款 提供。