caffe 下测试 MNIST数据
生活随笔
收集整理的這篇文章主要介紹了
caffe 下测试 MNIST数据
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
詳細(xì)說明可參考網(wǎng)頁:http://blog.csdn.net/wangchuansnnu/article/details/44341753 ????????????????????????????????http://blog.sina.com.cn/s/blog_49ea41a20102w4uu.html
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? http://www.cnblogs.com/yymn/p/4553671.html
caffe 下 mnist 進(jìn)行實驗:
MNIST,一個經(jīng)典的手寫數(shù)字庫,包含60000個訓(xùn)練樣本和10000個測試樣本,圖片大小28*28 均在 caffe根目錄下執(zhí)行 1.下載數(shù)據(jù):sudo sh ./data/mnist/get_mnist.sh 2.生成lmdb文件:sudo sh ./examples/mnist/create_mnist.sh ? 此時在當(dāng)前文件目錄下生成?mnist_train_lmdb, mnist_test_lmdb 文件 3.配置網(wǎng)絡(luò): letNet網(wǎng)絡(luò)的定義 ? ?? 在 ./examples/mnist/lenet_train_test_prototxt文件中,可直接打開編輯 ? ? sudogedit?./examples/mnist/lenet_train_test_prototxt ? ?本文不修改lenet_train_test_prototxt直接調(diào)用,即不改變網(wǎng)絡(luò)的結(jié)構(gòu)。 4.運行 ./examples/mnist/train_lenet.sh ? ?sudo sh ./examples/mnist/train_lenet.sh??這是訓(xùn)練網(wǎng)絡(luò)的程序 ? ?? ? ? 查看train_lenet.sh ,可用 sudo gedit ./examples/mnist/train_lenet.sh查看 ? ?? ? ?#!/usr/bin/env sh? ?? ? ?? ./build/tools/caffe train--solver=examples/mnist/lenet_solver.prototxt
? ?? ? ?? 可發(fā)現(xiàn)上述執(zhí)行的是examples/mnist/lenet_solver.prototxt,其實使用的是在lenet_solver.prototxt中定義的解決方案。 ? ?? ? ?? ?查看lent_solver.prototxt可知,這個是訓(xùn)練網(wǎng)絡(luò)的參數(shù)設(shè)置,比如學(xué)習(xí)率,顯示結(jié)果參數(shù),是否采用CPU 或者GPU等 ? ?本文不修改letnet_solver.prototxt ,即采用默認(rèn)的解決方案。 5.測試數(shù)據(jù)集 ??有三種接口可以進(jìn)行測試數(shù)據(jù),命令行、Python、MATLAB,本例中采用命令行進(jìn)行測試,在 ?/examples/mnist路徑下,執(zhí)行: ?sudo sh?./examples/mnist/test_lenent.sh ? 下面是test_lenet.sh的內(nèi)容
? ./build/tools/caffe test?-model=examples/mnist/lenet_train_test.prototxt?-weights=examples/mnist/lenet_iter_10000.caffemodel?-gpu=0
?test:表示對訓(xùn)練好的模型進(jìn)行Testing,而不是training。其他參數(shù)包括train,time, device_query。
-model=XXX:指定模型prototxt文件,這是一個文本文件,詳細(xì)描述了網(wǎng)絡(luò)結(jié)構(gòu)和數(shù)據(jù)集信息。
?? 注意:test_lenent.sh腳本是根據(jù)train_lenet.sh腳本對照改寫的。 ?下面給出MNIST結(jié)構(gòu)網(wǎng)絡(luò)的圖示,(轉(zhuǎn)載)
總結(jié)
以上是生活随笔為你收集整理的caffe 下测试 MNIST数据的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 华夏银行信用卡还款日可以改吗?还款日没还
- 下一篇: caffe 提取特征并可视化(已测试可执