Faster-Rcnn的loss曲线可视化
来源:互联网 发布:美国历年财政支出数据 编辑:程序博客网 时间:2024/06/05 17:19
由于要写论文需要画loss曲线,查找网上的loss曲线可视化的方法发现大多数是基于Imagenat的一些方法,在运用到Faster-Rcnn上时没法用,本人不怎么会编写代码,所以想到能否用python直接写一个代码,读取txt然后画出来,参考大神们的博客,然后总和总算一下午时间,搞出来了,大牛们不要见笑。
首先,在训练Faster-Rcnn时会自己生成log文件,大概在/py-faster-rcnn/experiments/logs文件下,把他直接拿出来,放在任意位置即可,因为是txt格式,可以直接用,如果嫌麻烦重命名1.txt.接下来就是编写程序了
一下为log基本的格式
I0530 08:54:19.183091 10143 solver.cpp:229] Iteration 22000, loss = 0.173712
I0530 08:54:19.183137 10143 solver.cpp:245] Train net output #0: rpn_cls_loss = 0.101713 (* 1 = 0.101713 loss)
I0530 08:54:19.183145 10143 solver.cpp:245] Train net output #1: rpn_loss_bbox = 0.071999 (* 1 = 0.071999 loss)
I0530 08:54:19.183148 10143 sgd_solver.cpp:106] Iteration 22000, lr = 0.001
通过发现,我们只需获得 Iteration 和loss就行
#!/usr/bin/env pythonimport osimport sysimport numpy as npimport matplotlib.pyplot as pltimport mathimport reimport pylabfrom pylab import figure, show, legendfrom mpl_toolkits.axes_grid1 import host_subplot# read the log filefp = open('2.txt', 'r')train_iterations = []train_loss = []test_iterations = []#test_accuracy = []for ln in fp: # get train_iterations and train_loss if '] Iteration ' in ln and 'loss = ' in ln: arr = re.findall(r'ion \b\d+\b,',ln) train_iterations.append(int(arr[0].strip(',')[4:])) train_loss.append(float(ln.strip().split(' = ')[-1])) fp.close()host = host_subplot(111)plt.subplots_adjust(right=0.8) # ajust the right boundary of the plot window#par1 = host.twinx()# set labelshost.set_xlabel("iterations")host.set_ylabel("RPN loss")#par1.set_ylabel("validation accuracy")# plot curvesp1, = host.plot(train_iterations, train_loss, label="train RPN loss")#p2, = par1.plot(test_iterations, test_accuracy, label="validation accuracy")# set location of the legend, # 1->rightup corner, 2->leftup corner, 3->leftdown corner# 4->rightdown corner, 5->rightmid ...host.legend(loc=1)# set label colorhost.axis["left"].label.set_color(p1.get_color())#par1.axis["right"].label.set_color(p2.get_color())# set the range of x axis of host and y axis of par1host.set_xlim([-1500,60000])host.set_ylim([0., 1.6])plt.draw()plt.show()绘图结果
参考博客地址:
http://blog.csdn.net/YhL_Leo/article/details/51774966
- Faster-Rcnn的loss曲线可视化
- Faster RCNN中间层可视化
- faster RCNN的Python的画出来loss曲线图
- Caffe的可视化训练:绘制loss和accuracy曲线
- 【DeepLearning_Visualization】Note1:caffe保存训练日志和accuracy曲线,Loss曲线的可视化
- faster-rcnn的记录
- faster rcnn的测试
- faster rcnn训练过程出现loss=nan解决办法
- tensorboard 的可视化 同得到train和validation的loss曲线
- Caffe 的可视化 (五)Caffe 中绘制 accuracy 和 loss 曲线
- 从RCNN到Faster RCNN 的发展
- Faster RCNN 的py-faster-rcnn详细配置安装过程
- faster rcnn 的重新训练
- faster-rcnn遇到的问题
- Faster RCNN的理解点
- faster RCNN 的细节理解
- Faster-RCNN遇到的问题
- 深度学习RCNN, Fast-RCNN, Faster-RCNN的一些事
- 访问网页的各种http状态码的解释说明
- Java集合类二集合类详解及使用
- 数据挖掘学习笔记-关于数据的基本概念
- Linux文件系统调用----实现对树形文件结构的广度优先遍历,即按层输出文件信息
- 使用jsch-spring-boot在本地访问远程云服务
- Faster-Rcnn的loss曲线可视化
- RxJava 1.0版本入门篇之--2
- 玲珑学院 1125 咸鱼商店(二分+01背包)
- Codeforces 817D Imbalanced Array
- 使用git和github进行协同开发流程
- 字符串-leetcode 344 Reverse String
- Android开发环境搭建——集成了Eclipse的ADT Bundle + SDK
- PHP冒泡排序法 | 黄乔国PHP
- 25张图让你读懂神经网络架构