日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

Theano mnist数据集格式

發(fā)布時間:2024/9/20 36 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Theano mnist数据集格式 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

首先鏈接一篇大牛的Theano文檔翻譯:http://www.cnblogs.com/xueliangliu/archive/2013/04/03/2997437.html

里面有mnist.pkl.gz 手動下載地址(因為代碼里也有自動下載方法)

?

那么我不是做圖像處理的,所以對圖像的存儲格式沒有什么概念,我要以其他方式輸入進theano程序中怎么辦呢?

于是就得分析它的存儲格式。代碼(logistic_sgd.py,line 195)注釋中說的已經很清楚了:

#train_set, valid_set, test_set format: tuple(input, target) #input is an numpy.ndarray of 2 dimensions (a matrix) #witch row's correspond to an example. target is a #numpy.ndarray of 1 dimensions (vector)) that have the same length as #the number of rows in the input. It should give the target #target to the example with the same index in the input.

那么就是說train_X是一個rows行2列的矩陣,train_Y是一個rows維的向量,而train_set是train_X和train_Y的一個組合

那么我們只需要讀文件構建矩陣和向量,然后share成theano程序里的類型就ok啦

?

?

?

===================割=========================

想不到后來又重拾DL,如今已經是今非昔比了啊

再次補充一下Mnist數據集的格式

import cPickle, gzip, numpy# Load the dataset f = gzip.open('mnist.pkl.gz', 'rb') train_set, valid_set, test_set = cPickle.load(f) f.close()

事實證明它會返回一個tuple,分別是train vali test集。

每個集有兩維,以train set為例,分別是(50000, 784) (50000,1)代表著5W個樣本和5W個label,

每個樣本有784個維度 = 28*28

轉載于:https://www.cnblogs.com/zklidd/p/3886597.html

與50位技術專家面對面20年技術見證,附贈技術全景圖

總結

以上是生活随笔為你收集整理的Theano mnist数据集格式的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。