diff --git a/deploy/python/utils.py b/deploy/python/utils.py index 1a7fe211bbd4ff9caec88a45bea8a0f74e8b2abe..d0ad0d5441e0aa8055c0ea9734729eff21948e8f 100644 --- a/deploy/python/utils.py +++ b/deploy/python/utils.py @@ -190,8 +190,11 @@ class Timer(Times): 4) if average else self.inference_time_s.value() 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( - average_latency * 1000, 1 / average_latency)) + average_latency * 1000, qps)) print( "preprocess_time(ms): {:.2f}, inference_time(ms): {:.2f}, postprocess_time(ms): {:.2f}". format(preprocess_time * 1000, inference_time * 1000,