diff --git a/deploy/pipeline/pipe_utils.py b/deploy/pipeline/pipe_utils.py index d4a6307525bb903cc7f09331dbbdbaba5c707fd6..8cc863aa51c4e2df713fee181d9ea5c36257b50b 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 8cfb1dd132d706dbae72ff20f58c0ccea65ad12b..da2489682edd165d392a440e8660987b5fff2877 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