load_data
函數tf_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 授權條款 提供。