caffe之loss曲线绘制

Python 训练caffe之loss曲线绘制,以mnist为例:blog.csdn.net/Running_J/article/details/51505715
见/home/echo/caffe-master/examples/mnist/train_lenet_log.sh,运行:最后out.log则与控制台的输出是一模一样的

step2:解析日志文件  这一步利用caffe中tools/extra文件夹下的parse_log.py来解析日志文件。具体例子如下:
python parse_log.py out.log ./ #两个参数,一个是日志文件,另一个是保存的路径

运行结束之后会发现在你保存的路径中会生成两个文件out.log.train和out.log.test,其中seconds应该是时间吧。

step3:绘制accuracy 和loss曲线

注意:我运行出来之后,这两个文件的第一行就被注释了#,并且我的就是空格做的间隔,所以不用修改任何的

上面还有个地方需要解释就是那个2是什么意思,这个你直接运行下python plot_training_log.py就会打出帮助信息,就能看见了:

echo@echo-PC:~/caffe-master/examples/mnist$ python plot_training_log.py
This script mainly serves as the basis of your customizations.
Customization is a must.
You can copy, paste, edit them in whatever way you want.
Be warned that the fields in the training log may change in the future.
You had better check the data files and change the mapping from field name to
field index in create_field_index before designing your own plots.
Usage:
    ./plot_training_log.py chart_type[0-7] /where/to/save.png /path/to/first.log ...
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
python plot_training_log.py 2 testloss.png out.log#也就是只需要out.log文件

你可能感兴趣的:(caffe之loss曲线绘制)