Caffe可视化总结

1、网络结构可视化

可以使用:https://dgschwend.github.io/netscope/quickstart.html

Netscope是一个功能强大的在线工具,不仅可以将网络结构可视化,还可以对网络进行详尽的分析,计算ops、mem等(不支持一些特殊的层),是一个分析结构的有力帮手。

2、loss分析及可视化

2.1 绘制loss曲线

loss可视化有多种方式,例如使用caffe自带的工具,可以参考 https://blog.csdn.net/auto1993/article/details/71293678

也可以编写脚本来完成,如使用python中的matplotlib。

#!/usr/bin/env python  
import os  
import sys  
import numpy as np  
import matplotlib.pyplot as plt  
import math  
import re  
import pylab  
from pylab import figure, show, legend  
from mpl_toolkits.axes_grid1 import host_subplot  

train_iterations = []  
train_loss = []  

fp = open('logfile', 'r') 

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  

# set labels  
host.set_xlabel("iterations")  
host.set_ylabel("loss")  

# plot curves  
p1, = host.plot(train_iterations, train_loss, label="train loss")  

host.legend(loc=1)  

# set label color  
host.axis["left"].label.set_color(p1.get_color())  
host.set_xlim([-1000, 50000])  
host.set_ylim([0., 100])  

plt.draw()  
plt.show()  

2.1 计算loss均值

除了绘制总的loss的曲线外,还可以编写脚本文件计算loss均值来进行分析。例如可以用cat和grep指令在log文件中搜索所需的关键字,然后计算均值并输出。如果网络有多个stage,可以编写多个关键字的指令,分别计算分段的loss均值。

3、结果可视化

待补充。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值