作者:kusoGod
链接:https://www.zhihu.com/question/49521165/answer/127675889
来源:知乎
链接:https://www.zhihu.com/question/49521165/answer/127675889
来源:知乎
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.windows记录训练日志:在训练过程中的命令中加入一行参数 ,实现Log日志的记录,这里我使用的.bat。其实一可以像前面某位大哥一样,直接copy输出的类容。
caffe train --solver=deepid/deepid2/deepid_solver.prototxt >log/XXXXX.log 2>&1
pause
这样训练结束之后,会在Log文件夹中生成每次训练的Log日志,但是生成的是这样的文件XXXXX.log. 如果没有生成,那你可以改成TXT后缀 后面在重名名2.解析训练日志将最上面说的3个脚本文件拷贝到Log 文件夹下,生成XXXXX.log (这里记得不要使用python3,因为有些地方不兼容,如果只有python3,那你可以根据提示修改相应的代码 下同)python parse_log.py log/XXXXX.log .
后面的参数为log文件名,这样就会在当前文件夹下生成一个.train文件和一个.test文件3.生成图片执行:
后面的参数为log文件名,这样就会在当前文件夹下生成一个.train文件和一个.test文件3.生成图片执行:
python plot_training_log.py 0 save.png XXXX.log
这里是需要png图片。需要修改plot_training_log.py。可以生成训练过程中的Test accuracy vs. Iters 曲线,其中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: Train learning rate vs. Iters
3: Train learning rate vs. Seconds
4: Test loss vs. Iters
5: Test loss vs. Seconds
6: Train learning rate vs. Iters
7: Train learning rate vs. Seconds
8: Train loss vs. Iters
9: Train loss vs. Seconds
最后,看一下效果
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: Train learning rate vs. Iters
3: Train learning rate vs. Seconds
4: Test loss vs. Iters
5: Test loss vs. Seconds
6: Train learning rate vs. Iters
7: Train learning rate vs. Seconds
8: Train loss vs. Iters
9: Train loss vs. Seconds
最后,看一下效果