caffe 訓練log視覺化
轉自:http://www.cnblogs.com/Allen-rg/p/5822332.html
轉自:http://blog.csdn.net/u013078356/article/details/51154847
在caffe的訓練過程中,大家難免想圖形化自己的訓練資料,以便更好的展示結果。如 果自己寫程式碼記錄訓練過程的資料,那就太麻煩了,caffe中其實已經自帶了這樣的小工具 caffe-master/tools/extra/parse_log.sh caffe-master/tools/extra/extract_seconds.py和 caffe-master/tools/extra/plot_training_log.py.example ,使用方法如下:
1.記錄訓練日誌
在訓練過程中的命令中加入一行引數 ,實現Log日誌的記錄
GLOG_logtostderr=0 GLOG_log_dir=/home/liuyun/caffe/models/AAA/A12/Log/ \
/home/liuyun/caffe/build/tools/caffe train -solver examples/AAA/solver.prototxt -weights ./models/bvlc_reference_caffenet/bvlc_reference_caffenet.caffemodel
其中目錄改成自己系統的目錄,這樣訓練結束之後,會在Log資料夾中生成每次訓練的Log日誌。
2.解析訓練日誌
將最上面說的3個指令碼檔案拷貝到Log 資料夾下,執行:
1 |
./parse_log.sh
caffe.liuyun-860-088cn.root.log.INFO.20160830-090533.5367
|
這樣就會在當前資料夾下生成一個.train檔案和一個.test檔案
3.生成圖片
執行:
1 |
./plot_training_log.py.example
6 train_loss.png caffe.liuyun-860-088cn.root.log
|
注意:一定將caffe.liuyun-860-088cn.root.log.INFO.20160830-090533.5367改為caffe.liuyun-860-088cn.root.log,.log為字尾。
就可以生成訓練過程中的Train loss vs. Iters 曲線,其中6代表曲線型別, train_loss.png 代表儲存的圖片名稱
caffe中支援很多種曲線繪製,通過指定不同的型別引數即可,具體引數如下:
1 2 3 4 5 6 7 8 9 10 11 12 |
Notes:
1.
Supporting multiple logs.
2.
Log file name must end with the lower-cased ".log" .
Supported
chart types:
0:
Test accuracy vs. Iters
1:
Test accuracy vs. Seconds
2:
Test loss vs. Iters
3:
Test loss vs. Seconds
4:
Train learning rate vs. Iters
5:
Train learning rate vs. Seconds
6:
Train loss vs. Iters
7:
Train loss vs. Seconds
|
最後,看一下效果: