参考:http://blog.csdn.net/u013078356/article/details/51154847
之前已经编译了matcaffe 和 pycaffe
caffe中其实已经自带了这样的小工具 caffe-master/tools/extra/parse_log.sh caffe-master/tools/extra/extract_seconds.py和 caffe-master/tools/extra/plot_training_log.py.example;拷贝以上文件到当前目录下
(一)保存输出到log文件,更改脚本文件 train_caffenet.sh;更改如上
在exampless/test 目录下就会有一个log开头的文件, 可以用 vim 打开浏览内容
#!/usr/bin/env sh
TOOLS=./build/tools
LOG=examples/mytest/code/model64/log-'data +%Y-%m-%d-%H-%S'.log
$TOOLS/caffe train \
--solver=examples/mytest/code/model64/recapture_solver.prototxt -gpu all 2>&1 | tee $LOG
(二)解析log中的内容 分成train 和 test 会在当前文件夹下生成log-data.train 和 log-data.test两个文件
./parse_log.sh log-data
(三) 更改log-data的名字为log-data.log;备注:必须是.log后缀才能解析
mv log-data log-data.log
(四) 调用py程序绘制图形
./plot_training_log.py.example 0 save.png log-data.log
其中0代表曲线类型, save.png 代表保存的图片名称 caffe中支持很多种曲线绘制,通过指定不同的类型参数即可,具体参数如下
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
遇到的问题:
1.ImportError: No module named matplotlib.pyplot
2.ImportError: /usr/local/MATLAB/R2013a/sys/os/glnxa64/libgfortran.so.3: vers
ion `GFORTRAN_1.4' not found (required by /usr/lib/liblapack.so.3)
解决方案:
1. sudo apt-get installPython-matplotlib
2. locate libgfortran.so.3
#显示出lib....so.3的位置
sudo ln -sf /usr/lib/x86_64-Linux-gnu/libgfortran.so.3 /usr/local/MATLAB/R201
3a/sys/os/glnxa64/libgfortran.so.3
(一)ssd的log文件保存在 /home/myname/caffe/jobs/ 下面
(二) 调用py程序绘制图形
./plot_training_log.py.example 0 save.png /home/myname/caffe/jobs/VGGNet/VOCgoods/SSD_600x600/VGG_VOCgoods_SSD_600x600.log"
其中0代表曲线类型, save.png 代表保存的图片名称 caffe中支持很多种曲线绘制,通过指定不同的类型参数即可,具体参数如下
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