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

add per trackid time info (#6664)

上级 601964b4
......@@ -68,6 +68,7 @@ class PipeTimer(Times):
'vehicleplate': Times()
}
self.img_num = 0
self.track_num = 0
def get_total_time(self):
total_time = self.total_time.value()
......@@ -86,8 +87,11 @@ class PipeTimer(Times):
for k, v in self.module_time.items():
v_time = round(v.value(), 4)
if v_time > 0:
if v_time > 0 and k in ['det', 'mot', 'video_action']:
print("{} time(ms): {}".format(k, v_time * 1000))
elif v_time > 0:
print("{} time(ms): {}; per trackid average time(ms): {}".
format(k, v_time * 1000, v_time * 1000 / self.track_num))
print("average latency time(ms): {:.2f}, QPS: {:2f}".format(
average_latency * 1000, qps))
......
......@@ -598,10 +598,11 @@ class PipePredictor(object):
if not ret:
break
frame_rgb = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
if frame_id > self.warmup_frame:
self.pipe_timer.total_time.start()
if self.modebase["idbased"] or self.modebase["skeletonbased"]:
if frame_id > self.warmup_frame:
self.pipe_timer.total_time.start()
self.pipe_timer.module_time['mot'].start()
mot_skip_frame_num = self.mot_predictor.skip_frame_num
......@@ -612,11 +613,12 @@ class PipePredictor(object):
[copy.deepcopy(frame_rgb)],
visual=False,
reuse_det_result=reuse_det_result)
if frame_id > self.warmup_frame:
self.pipe_timer.module_time['mot'].end()
# mot output format: id, class, score, xmin, ymin, xmax, ymax
mot_res = parse_mot_res(res)
if frame_id > self.warmup_frame:
self.pipe_timer.module_time['mot'].end()
self.pipe_timer.track_num += len(mot_res['boxes'])
# flow_statistic only support single class MOT
boxes, scores, ids = res[0] # batch size = 1 in MOT
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册