未验证 提交 a76e404d 编写于 作者: L littletomatodonkey 提交者: GitHub

fix time sta (#457)

上级 a73573a3
...@@ -429,16 +429,16 @@ def run(dataloader, ...@@ -429,16 +429,16 @@ def run(dataloader,
feed=feed_dict, feed=feed_dict,
fetch_list=fetch_list) fetch_list=fetch_list)
batch_time.update(time.time() - tic) batch_time.update(time.time() - tic)
tic = time.time()
for i, m in enumerate(metrics): for i, m in enumerate(metrics):
metric_list[i].update(np.mean(m), batch_size) metric_list[i].update(np.mean(m), batch_size)
if mode == "train": if mode == "train":
metric_list[-1].update(lr_scheduler.get_lr()) metric_list[-1].update(lr_scheduler.get_lr())
fetchs_str = ''.join([str(m.value) + ' ' fetchs_str = ''.join([str(m.value) + ' '
for m in metric_list] + [batch_time.value]) + 's' for m in metric_list] + [batch_time.mean]) + 's'
ips_info = " ips: {:.5f} images/sec.".format(batch_size / ips_info = " ips: {:.5f} images/sec.".format(batch_size /
batch_time.val) batch_time.avg)
fetchs_str += ips_info fetchs_str += ips_info
if lr_scheduler is not None: if lr_scheduler is not None:
...@@ -471,6 +471,8 @@ def run(dataloader, ...@@ -471,6 +471,8 @@ def run(dataloader,
logger.coloring(step_str, "PURPLE"), logger.coloring(step_str, "PURPLE"),
logger.coloring(fetchs_str, 'OKGREEN'))) logger.coloring(fetchs_str, 'OKGREEN')))
tic = time.time()
end_str = ''.join([str(m.mean) + ' ' end_str = ''.join([str(m.mean) + ' '
for m in metric_list] + [batch_time.total]) + 's' for m in metric_list] + [batch_time.total]) + 's'
ips_info = "ips: {:.5f} images/sec.".format(batch_size * batch_time.count / ips_info = "ips: {:.5f} images/sec.".format(batch_size * batch_time.count /
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册