讓一個 caffe 跑起來的流程及注意事項

需要三個文件,以mnist爲例,有這三個 train_lenet.sh,lenet_solver.prototxt,lenet_train_test.prototxt。
總的來說,執行 train_lenet.sh —> lenet_solver.prototxt —> lenet_train_test.prototxt,再開始訓練網絡。

①其中, train_lenet.sh是自己定義的腳本文件,內容如下:
/home/justin/caffe/build/tools/caffe train -solver lenet_solver.prototxt
-sigint_effect snapshot 2>&1 | tee -a ./lenet/solve.log

注意路徑,上面的腳本要和lenet_solver.prototxt放一個目錄下,腳本才能調用lenet_solver.prototxt。
./lenet/solve.log 意思是在當前目錄下的lenet文件夾,保存訓練的log文件。
2>&1的解釋:Linux的輸出中 1 表示標準輸出,2 表示錯誤輸出,2>&1 表示將錯誤的輸入重定向到標準的輸出中去。(這個不是很懂具體的意思)

②其中,lenet_solver.prototxt中注意

net: "lenet_train_test.prototxt"
snapshot_prefix: "lenet/"

lenet_solver.prototxt要和lenet_train_test.prototxt在一個目錄下,lenet_solver.prototxt才能調用lenet_train_test.prototxt。
snapshot_prefix在train_lenet.sh和lenet_solver.prototxt中都要定義,不然會報錯。

③其中,lenet_train_test.prototxt定義的是網絡結構,這裏要注意數據的路徑

 source: "./mnist_train_lmdb"

上面的意思是當前路徑的mnist_train_lmdb存放了訓練數據。

發佈了22 篇原創文章 · 獲贊 40 · 訪問量 8萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章