tensorflow mnist 數據加載實現并畫圖效果
關于 TensorFlow
TensorFlow™ 是一個采用數據流圖(data flow graphs),用于數值計算的開源軟件庫。節(jié)點(Nodes)在圖中表示數學操作,圖中的線(edges)則表示在節(jié)點間相互聯系的多維數據數組,即張量(tensor)。它靈活的架構讓你可以在多種平臺上展開計算,例如臺式計算機中的一個或多個CPU(或GPU),服務器,移動設備等等。TensorFlow 最初由Google大腦小組(隸屬于Google機器智能研究機構)的研究員和工程師們開發(fā)出來,用于機器學習和深度神經網絡方面的研究,但這個系統(tǒng)的通用性使其也可廣泛用于其他計算領域。
Tensorflow是谷歌公司在2015年9月開源的一個深度學習框架。
正文開始:
直接看代碼:
%matplotlib from tensorflow.examples.tutorials.mnist import input_data import matplotlib.pyplot as plt mnist = input_data.read_data_sets('MNIST_data', one_hot=True) print('Training data size: ', mnist.train.num_examples) print('Validation data size: ', mnist.validation.num_examples) print('Test data size: ', mnist.test.num_examples) img0 = mnist.train.images[0].reshape(28,28) img1 = mnist.train.images[1].reshape(28,28) img2 = mnist.train.images[2].reshape(28,28) img3 = mnist.train.images[3].reshape(28,28) fig = plt.figure(figsize=(10,10)) ax0 = fig.add_subplot(221) ax1 = fig.add_subplot(222) ax2 = fig.add_subplot(223) ax3 = fig.add_subplot(224) ax0.imshow(img0) ax1.imshow(img1) ax2.imshow(img2) ax3.imshow(img3) fig.show()
畫圖結果:
總結
以上所述是小編給大家介紹的tensorflow mnist 數據加載實現并畫圖效果,希望對大家有所幫助!
相關文章
Python使用tkinter模塊實現GUI界面的學生信息管理系統(tǒng)流程分步詳解
這篇文章主要為大家詳細介紹了python實現簡易學生信息管理系統(tǒng),文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下2023-01-01Jupyter Notebook中%time和%timeit的使用詳解
本文主要介紹了Jupyter Notebook中%time和%timeit的使用詳解,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧2023-02-02