提交 be9b45d9 编写于 作者: littletomatodonkey's avatar littletomatodonkey

add reader time

上级 24b8453b
...@@ -275,20 +275,22 @@ def run(dataloader, ...@@ -275,20 +275,22 @@ def run(dataloader,
use_mix = config.get("use_mix", False) and mode == "train" use_mix = config.get("use_mix", False) and mode == "train"
metric_list = [ metric_list = [
("loss", AverageMeter('loss', '7.4f')), ("loss", AverageMeter('loss', '7.5f')),
("lr", AverageMeter( ("lr", AverageMeter(
'lr', 'f', need_avg=False)), 'lr', 'f', need_avg=False)),
("batch_time", AverageMeter('elapse', '.3f')), ("batch_time", AverageMeter('elapse', '.7f')),
("reader_time", AverageMeter('reader ', '.7f')),
] ]
if not use_mix: if not use_mix:
topk_name = 'top{}'.format(config.topk) topk_name = 'top{}'.format(config.topk)
metric_list.insert(1, (topk_name, AverageMeter(topk_name, '.4f'))) metric_list.insert(1, (topk_name, AverageMeter(topk_name, '.5f')))
metric_list.insert(1, ("top1", AverageMeter("top1", '.4f'))) metric_list.insert(1, ("top1", AverageMeter("top1", '.5f')))
metric_list = OrderedDict(metric_list) metric_list = OrderedDict(metric_list)
tic = time.time() tic = time.time()
for idx, batch in enumerate(dataloader()): for idx, batch in enumerate(dataloader()):
metric_list['reader_time'].update(time.time() - tic)
batch_size = len(batch[0]) batch_size = len(batch[0])
feeds = create_feeds(batch, use_mix) feeds = create_feeds(batch, use_mix)
fetchs = create_fetchs(feeds, net, config, mode) fetchs = create_fetchs(feeds, net, config, mode)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册