Ubuntu 14.04 64位機上用Caffe+MNIST訓練Lenet網絡操作步驟
1.將終端定位到Caffe根目錄;
2.下載MNIST數據庫並解壓縮:$ ./data/mnist/get_mnist.sh
3.將其轉換成Lmdb數據庫格式:$ ./examples/mnist/create_mnist.sh
執行完此shell腳本後,會在./examples/mnist下增加兩個新目錄,mnist_test_lmdb和mnist_train_lmdb
4.train model:$ ./examples/mnist/train_lenet.sh
(1)、使用LeNet網絡(《Gradient-BasedLearning Applied to Document Recognition》);
(2)、使用./examples/mnist/lenet_train_test.prototxtmodel;
(3)、使用./examples/mnist/lenet_solver.prototxtmodel;
(4)、執行train_lenet.sh腳本,會調用./build/tools目錄下的caffe執行文件,此執行文件的實現是./tools目錄下的caffe.cpp文件;
(5)、執行此腳本後,會生成幾個文件,其中./examples/mnist/lenet_iter_10000.caffemodel則是最終訓練生成的model文件;
(6)、以上默認的是在GPU模式下運行,如果想讓其在CPU模式下運行,只需將lenet_solver.prototxt文件中的solver_mode字段值由原來的GPU改為CPU即可;
運行結果如下圖:
參考文獻:http://caffe.berkeleyvision.org/gathered/examples/mnist.html
更多Ubuntu相關信息見Ubuntu 專題頁面 http://www.linuxidc.com/topicnews.aspx?tid=2