From 28199de73e51ff08f54d941c83ee24056ffd16dd Mon Sep 17 00:00:00 2001 From: zhiboniu <31800336+zhiboniu@users.noreply.github.com> Date: Wed, 17 Aug 2022 00:04:47 +0800 Subject: [PATCH] add per trackid time info (#6664) --- deploy/pipeline/pipe_utils.py | 6 +++++- deploy/pipeline/pipeline.py | 8 +++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/deploy/pipeline/pipe_utils.py b/deploy/pipeline/pipe_utils.py index d4a630752..8cc863aa5 100644 --- a/deploy/pipeline/pipe_utils.py +++ b/deploy/pipeline/pipe_utils.py @@ -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)) diff --git a/deploy/pipeline/pipeline.py b/deploy/pipeline/pipeline.py index 8cfb1dd13..da2489682 100644 --- a/deploy/pipeline/pipeline.py +++ b/deploy/pipeline/pipeline.py @@ -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 -- GitLab