未验证 提交 ab7190d9 编写于 作者: Z zhiboniu 提交者: GitHub

fix qps nan int python/utils.pyL192 (#4421)

上级 45986d1e
...@@ -190,8 +190,11 @@ class Timer(Times): ...@@ -190,8 +190,11 @@ class Timer(Times):
4) if average else self.inference_time_s.value() 4) if average else self.inference_time_s.value()
average_latency = total_time / max(1, self.img_num) average_latency = total_time / max(1, self.img_num)
qps = 0
if total_time > 0:
qps = 1 / average_latency
print("average latency time(ms): {:.2f}, QPS: {:2f}".format( print("average latency time(ms): {:.2f}, QPS: {:2f}".format(
average_latency * 1000, 1 / average_latency)) average_latency * 1000, qps))
print( print(
"preprocess_time(ms): {:.2f}, inference_time(ms): {:.2f}, postprocess_time(ms): {:.2f}". "preprocess_time(ms): {:.2f}, inference_time(ms): {:.2f}, postprocess_time(ms): {:.2f}".
format(preprocess_time * 1000, inference_time * 1000, format(preprocess_time * 1000, inference_time * 1000,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册