提交 994d198e 编写于 作者: S shippingwang

add reader

上级 5203c85f
...@@ -314,6 +314,7 @@ def run(dataloader, config, net, optimizer=None, epoch=0, mode='train'): ...@@ -314,6 +314,7 @@ def run(dataloader, config, net, optimizer=None, epoch=0, mode='train'):
("lr", AverageMeter( ("lr", AverageMeter(
'lr', 'f', need_avg=False)), 'lr', 'f', need_avg=False)),
("batch_time", AverageMeter('elapse', '.3f')), ("batch_time", AverageMeter('elapse', '.3f')),
('reader_time', AverageMeter('reader', '.3f')),
]) ])
else: else:
topk_name = 'top{}'.format(config.topk) topk_name = 'top{}'.format(config.topk)
...@@ -324,10 +325,12 @@ def run(dataloader, config, net, optimizer=None, epoch=0, mode='train'): ...@@ -324,10 +325,12 @@ def run(dataloader, config, net, optimizer=None, epoch=0, mode='train'):
("lr", AverageMeter( ("lr", AverageMeter(
'lr', 'f', need_avg=False)), 'lr', 'f', need_avg=False)),
("batch_time", AverageMeter('elapse', '.3f')), ("batch_time", AverageMeter('elapse', '.3f')),
('reader_time', AverageMeter('reader', '.3f')),
]) ])
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.
先完成此消息的编辑!
想要评论请 注册