From e6216d507cc373e00f6735222e8c7cb259c5193b Mon Sep 17 00:00:00 2001 From: lazyn1997 <34644177+lazyn1997@users.noreply.github.com> Date: Tue, 17 May 2022 15:33:27 +0800 Subject: [PATCH] fix video infer(#5107) (#5931) * fix video infer(#5107) * fix video infer(others) --- deploy/python/infer.py | 2 +- deploy/python/keypoint_infer.py | 2 +- deploy/python/mot_jde_infer.py | 2 +- deploy/python/mot_keypoint_unite_infer.py | 7 +++++-- deploy/python/mot_sde_infer.py | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/deploy/python/infer.py b/deploy/python/infer.py index fd43874c3..368c5b688 100644 --- a/deploy/python/infer.py +++ b/deploy/python/infer.py @@ -329,7 +329,7 @@ class Detector(object): break print('detect frame: %d' % (index)) index += 1 - results = self.predict_image([frame], visual=False) + results = self.predict_image([frame[:, :, ::-1]], visual=False) im = visualize_box_mask( frame, diff --git a/deploy/python/keypoint_infer.py b/deploy/python/keypoint_infer.py index 4227a281a..70b813756 100644 --- a/deploy/python/keypoint_infer.py +++ b/deploy/python/keypoint_infer.py @@ -266,7 +266,7 @@ class KeyPointDetector(Detector): break print('detect frame: %d' % (index)) index += 1 - results = self.predict_image([frame], visual=False) + results = self.predict_image([frame[:, :, ::-1]], visual=False) im_results = {} im_results['keypoint'] = [results['keypoint'], results['score']] im = visualize_pose( diff --git a/deploy/python/mot_jde_infer.py b/deploy/python/mot_jde_infer.py index 546942b21..51a2562ee 100644 --- a/deploy/python/mot_jde_infer.py +++ b/deploy/python/mot_jde_infer.py @@ -296,7 +296,7 @@ class JDE_Detector(Detector): timer.tic() seq_name = video_out_name.split('.')[0] mot_results = self.predict_image( - [frame], visual=False, seq_name=seq_name) + [frame[:, :, ::-1]], visual=False, seq_name=seq_name) timer.toc() online_tlwhs, online_scores, online_ids = mot_results[0] diff --git a/deploy/python/mot_keypoint_unite_infer.py b/deploy/python/mot_keypoint_unite_infer.py index 9f8413bb6..edf394152 100644 --- a/deploy/python/mot_keypoint_unite_infer.py +++ b/deploy/python/mot_keypoint_unite_infer.py @@ -167,7 +167,10 @@ def mot_topdown_unite_predict_video(mot_detector, # mot model timer_mot.tic() - mot_results = mot_detector.predict_image([frame], visual=False) + + frame2 = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB) + + mot_results = mot_detector.predict_image([frame2], visual=False) timer_mot.toc() online_tlwhs, online_scores, online_ids = mot_results[0] results = convert_mot_to_det( @@ -179,7 +182,7 @@ def mot_topdown_unite_predict_video(mot_detector, # keypoint model timer_kp.tic() keypoint_res = predict_with_given_det( - frame, results, topdown_keypoint_detector, keypoint_batch_size, + frame2, results, topdown_keypoint_detector, keypoint_batch_size, FLAGS.run_benchmark) timer_kp.toc() timer_mot_kp.toc() diff --git a/deploy/python/mot_sde_infer.py b/deploy/python/mot_sde_infer.py index ad514c08a..29b80751f 100644 --- a/deploy/python/mot_sde_infer.py +++ b/deploy/python/mot_sde_infer.py @@ -414,7 +414,7 @@ class SDE_Detector(Detector): timer.tic() seq_name = video_out_name.split('.')[0] mot_results = self.predict_image( - [frame], visual=False, seq_name=seq_name) + [frame[:, :, ::-1]], visual=False, seq_name=seq_name) timer.toc() # bs=1 in MOT model -- GitLab