mnist手寫數字識別資料初探

2021-08-20 11:42:32 字數 1263 閱讀 7780

mnist手寫數字識別為學習tensorflow等深度學習框架的入門經典資料集,tensorflow有直接載入mnist資料庫相關的模組, 其地位類似於使用r語言作資料探勘中的iris資料集。網路上關於使用mnist資料集實現各類深度學習演算法的**非常多,但是對於初學者而言,依著葫蘆畫瓢雖然將網上down的**跑通了,但是對於其中每個步驟或是資料集可能一臉懵逼,下面對該資料集做簡要的初步探索。

train-images-idx3-ubyte.gz: 訓練集

train-labels-idx1-ubyte.gz: 訓練集列標

t10k-images-idx3-ubyte.gz: 測試集

t10k-labels-idx1-ubyte.gz: 測試集列標

2. 檢視訓練集和測試集數量

# 獲取訓練集第乙個的矩陣資料

> first_data=mnist.train.images[0]

> first_data

# 的維度

> print(first_data.shape)

# 將一維向量轉換成 28*28 的矩陣

> image_matrix=first_data.reshape((28,28))

# 輸出矩陣的維度

3. 視覺化資料集

mnist手寫數字識別

import tensorflow as tf import numpy as np from tensorflow.contrib.learn.python.learn.datasets.mnist import read data sets mnist read data sets f pyth...

MNIST手寫數字識別 tensorflow

神經網路一半包含三層,輸入層 隱含層 輸出層。如下圖所示 現以手寫數字識別為例 輸入為784個變數,輸出為10個節點,10個節點再通過softmax啟用函式轉化為 值。如下,準確率可達0.9226 import tensorflow as tf from tensorflow.examples.tu...

DNN識別mnist手寫數字

提取碼 sg3f 導庫import numpy as np import matplotlib.pyplot as plt import tensorflow as tf from tensorflow import keras from tensorflow.keras import layers...