-
大小: 3KB文件类型: .py金币: 1下载: 0 次发布日期: 2021-05-23
- 语言: Python
- 标签:
资源简介
绘制faster rcnn end-to-end训练方式的loss曲线,总的loss图,和4部分bbox loss/cls loss/rpn cls loss/rpn box loss
代码片段和文件信息
#!/usr/bin/env python
import matplotlib.pyplot as plt
import re
# read the log file
fp = open(‘faster_rcnn_end2end_VGG16_.txt.2017-11-14_21-57-31‘ ‘r‘)
train_iterations = []
train_loss = []
bbox_loss = []
cls_loss = []
rpn_cls_loss = []
rpn_loss_box = []
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]))
if ‘output #0: loss_bbox‘ in ln:
arr = re.findall(r‘loss_bbox = \d+.\d+[e-]*\d+‘ ln)
bbox_loss.append(float(arr[0].split(‘ ‘)[-1]))
if ‘output #1: loss_cls‘ in ln:
arr = re.findall(r‘loss_cls = \d+.\d+[e-]*\d+‘ ln)
cls_loss.append(float(arr[0].split(‘ ‘)[-1]))
if ‘output #2: rpn_cls_loss‘ in ln:
arr = re.findall(r‘rpn_cls_loss = \d+.\d+[e-]*\d+‘ ln)
rpn_cls_loss.append(float(arr[0].split(‘ ‘)[-1]))
if ‘output #3: rpn_loss_bbox‘ in ln:
arr = re.findall(r‘rpn_loss_bbox = \d+.\d+[e-]*\d+‘ ln)
rpn_loss_box.append(float(arr[0].split(‘ ‘)[-1]))
fp.close()
print rpn_cls_loss.index(max(rpn_cls_loss))
print rpn_cls_loss[2929]
fig = plt.figure()
plt.plot(train_iterations train_loss ‘k‘ label=“all loss“)
评论
共有 条评论