From a960b2f8f575ba87b0b60063d315af944cdc84ae Mon Sep 17 00:00:00 2001 From: Charlie839242 <122248300@qq.com> Date: Fri, 15 Oct 2021 00:52:37 +0800 Subject: [PATCH 1/4] small-change --- lite/examples/pose_estimation/raspberry_pi/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lite/examples/pose_estimation/raspberry_pi/utils.py b/lite/examples/pose_estimation/raspberry_pi/utils.py index ff7b7c3f772..4c2df1aced4 100644 --- a/lite/examples/pose_estimation/raspberry_pi/utils.py +++ b/lite/examples/pose_estimation/raspberry_pi/utils.py @@ -63,7 +63,7 @@ def visualize(image: np.ndarray, """ for person in list_persons: if person.score < instance_threshold: - continue + break keypoints = person.keypoints bounding_box = person.bounding_box From 563bcb409da9e0033cb74b11d97aa5cf8c9a66f3 Mon Sep 17 00:00:00 2001 From: Charlie839242 <122248300@qq.com> Date: Tue, 19 Oct 2021 15:45:10 +0800 Subject: [PATCH 2/4] np-average --- lite/examples/pose_estimation/raspberry_pi/data.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lite/examples/pose_estimation/raspberry_pi/data.py b/lite/examples/pose_estimation/raspberry_pi/data.py index b72f092cc61..7a09b73885c 100644 --- a/lite/examples/pose_estimation/raspberry_pi/data.py +++ b/lite/examples/pose_estimation/raspberry_pi/data.py @@ -108,6 +108,7 @@ def person_from_keypoints_with_scores( # Calculate person score by averaging keypoint scores. scores_above_threshold = list( filter(lambda x: x > keypoint_score_threshold, scores)) + scores_above_threshold = np.append(scores_above_threshold, 0) person_score = np.average(scores_above_threshold) return Person(keypoints, bounding_box, person_score) From 15edb303b41b6aad1cbe0325a290d1f9c65449e5 Mon Sep 17 00:00:00 2001 From: Charlie839242 <122248300@qq.com> Date: Tue, 19 Oct 2021 21:39:11 +0800 Subject: [PATCH 3/4] np-average --- lite/examples/pose_estimation/raspberry_pi/data.py | 3 +-- lite/examples/pose_estimation/raspberry_pi/utils.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lite/examples/pose_estimation/raspberry_pi/data.py b/lite/examples/pose_estimation/raspberry_pi/data.py index 7a09b73885c..302433ab81e 100644 --- a/lite/examples/pose_estimation/raspberry_pi/data.py +++ b/lite/examples/pose_estimation/raspberry_pi/data.py @@ -108,8 +108,7 @@ def person_from_keypoints_with_scores( # Calculate person score by averaging keypoint scores. scores_above_threshold = list( filter(lambda x: x > keypoint_score_threshold, scores)) - scores_above_threshold = np.append(scores_above_threshold, 0) - person_score = np.average(scores_above_threshold) + person_score = np.average(scores_above_threshold) if scores_above_threshold else 0 return Person(keypoints, bounding_box, person_score) diff --git a/lite/examples/pose_estimation/raspberry_pi/utils.py b/lite/examples/pose_estimation/raspberry_pi/utils.py index 4c2df1aced4..ff7b7c3f772 100644 --- a/lite/examples/pose_estimation/raspberry_pi/utils.py +++ b/lite/examples/pose_estimation/raspberry_pi/utils.py @@ -63,7 +63,7 @@ def visualize(image: np.ndarray, """ for person in list_persons: if person.score < instance_threshold: - break + continue keypoints = person.keypoints bounding_box = person.bounding_box From 27bd26d146c6699969f8a141ccd6d62b0edab3fb Mon Sep 17 00:00:00 2001 From: Charlie839242 <122248300@qq.com> Date: Tue, 19 Oct 2021 22:19:48 +0800 Subject: [PATCH 4/4] np-average --- lite/examples/pose_estimation/raspberry_pi/data.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lite/examples/pose_estimation/raspberry_pi/data.py b/lite/examples/pose_estimation/raspberry_pi/data.py index 302433ab81e..c2507f0b054 100644 --- a/lite/examples/pose_estimation/raspberry_pi/data.py +++ b/lite/examples/pose_estimation/raspberry_pi/data.py @@ -108,7 +108,7 @@ def person_from_keypoints_with_scores( # Calculate person score by averaging keypoint scores. scores_above_threshold = list( filter(lambda x: x > keypoint_score_threshold, scores)) - person_score = np.average(scores_above_threshold) if scores_above_threshold else 0 + person_score = np.average(scores_above_threshold) if scores_above_threshold != [] else 0 return Person(keypoints, bounding_box, person_score)