From 190e237b2114aef65a26045f78faadb6a6744471 Mon Sep 17 00:00:00 2001 From: JYChen Date: Mon, 25 Jul 2022 23:20:52 +0800 Subject: [PATCH] fix box filter when box_num > 0 but with no target class (#6506) --- deploy/python/det_keypoint_unite_infer.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/deploy/python/det_keypoint_unite_infer.py b/deploy/python/det_keypoint_unite_infer.py index df22cde8d..7b57714d1 100644 --- a/deploy/python/det_keypoint_unite_infer.py +++ b/deploy/python/det_keypoint_unite_infer.py @@ -37,8 +37,15 @@ KEYPOINT_SUPPORT_MODELS = { def predict_with_given_det(image, det_res, keypoint_detector, keypoint_batch_size, run_benchmark): + keypoint_res = {} + rec_images, records, det_rects = keypoint_detector.get_person_from_rect( image, det_res) + + if len(det_rects) == 0: + keypoint_res['keypoint'] = [[], []] + return keypoint_res + keypoint_vector = [] score_vector = [] @@ -47,7 +54,6 @@ def predict_with_given_det(image, det_res, keypoint_detector, rec_images, run_benchmark, repeats=10, visual=False) keypoint_vector, score_vector = translate_to_ori_images(keypoint_results, np.array(records)) - keypoint_res = {} keypoint_res['keypoint'] = [ keypoint_vector.tolist(), score_vector.tolist() ] if len(keypoint_vector) > 0 else [[], []] -- GitLab