• caffe绘制训练过程的loss和accuracy曲线


    转自: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 文件夹下,执行:

    ./parse_log.sh caffe.liuyun-860-088cn.root.log.INFO.20160830-090533.5367
    

     这样就会在当前文件夹下生成一个.train文件和一个.test文件

    3.生成图片

    执行

    ./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中支持很多种曲线绘制,通过指定不同的类型参数即可,具体参数如下:

        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  
    

     最后,看一下效果:



  • 相关阅读:
    MySQL用户权限管理
    索引 聚集索引 唯一索引 普通索引 联合索引 覆盖索引
    sql注入
    pymysql
    MySQL 多表查询
    MySQL 聚合函数以及 优先级
    mysql 语句 字段 和结构主键外键的增删改
    协程
    事件 event
    进程池和线程池 concurrent.futures import ProcessPoolExecutor,ThreadPoolExecutor
  • 原文地址:https://www.cnblogs.com/Allen-rg/p/5822332.html
Copyright © 2020-2023  润新知