这里注意运行的python版本,我下的caffe对应的是python2.7
参考:https://www.zhihu.com/question/49521165/answer/127675889
1.生成日志
caffe.exe train --solver=solver.prototxt --weights=model.caffemodel >train.log 2>&1
2.画图
(1)将 caffe-master\tools\extra\ 文件夹下的 parse_log.py、extract_seconds.py 、plot_training_log.py 还有 train.log 放到同一文件夹下
(2)修改 “plot_training_log.py” 文件
get_log_parsing_script()
create_field_index()
1 | field_index = {train_key:{'Iters':0, 'Seconds':1, train_key + ' learning rate':2, |
- load_data()
(3)python parse_log.py train.log ./
在当前目录下生成 .train、.test 文件
注意:之前很奇怪,不生成.train .test文件,后来发现是solver.prototxt中 display 参数的问题,应该是通过这个隔几次记录 accuracy、loss 值
(4)画图
python plot_training_log.py 0 accuracy.png train.log
python plot_training_log.py 6 lr.png train.log
python plot_training_log.py 8 loss.png train.log
数字参数对应的输出图的类型与plot_training_log.py中修改的create_field_index()有关
Supported chart types
0: Test accuracy vs. Iters
1: Test accuracy vs. Seconds
2: Test learning rate vs. Iters
3: Test 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