Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changing variable name for inference start time for proper latency calculation when using --infer_time #1471

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tools/eval_utils/eval_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ def eval_one_epoch(cfg, args, model, dataloader, epoch_id, logger, dist_test=Fal
load_data_to_gpu(batch_dict)

if getattr(args, 'infer_time', False):
start_time = time.time()
inference_start_time = time.time()

with torch.no_grad():
pred_dicts, ret_dict = model(batch_dict)

disp_dict = {}

if getattr(args, 'infer_time', False):
inference_time = time.time() - start_time
inference_time = time.time() - inference_start_time
infer_time_meter.update(inference_time * 1000)
# use ms to measure inference time
disp_dict['infer_time'] = f'{infer_time_meter.val:.2f}({infer_time_meter.avg:.2f})'
Expand Down