log for slow inference before hittimg warmup count
Summary:
Log for slow models for the first num_warmup * 2 iterations.
This is the change from after rebasing to
@@ -124,9 +124,10 @@ def inference_on_dataset(model, data_loader, evaluator):
total_compute_time += time.perf_counter() - start_compute_time
evaluator.process(inputs, outputs)
- if idx >= num_warmup * 2:
- seconds_per_img = total_compute_time / (idx + 1 - num_warmup)
- total_seconds_per_img = (time.perf_counter() - start_time) / (idx + 1 - num_warmup)
+ iters_after_start = idx + 1 - num_warmup * int(idx >= num_warmup)
+ seconds_per_img = total_compute_time / iters_after_start
+ if idx >= num_warmup * 2 or seconds_per_img > 5:
+ total_seconds_per_img = (time.perf_counter() - start_time) / iters_after_start
eta = datetime.timedelta(seconds=int(total_seconds_per_img * (total - idx - 1)))
log_every_n_seconds(
logging.INFO,
