From adff8450af2c5933d936a5cb49a50ce071122813 Mon Sep 17 00:00:00 2001 From: ascendhuawei <44194787+ascendhuawei@users.noreply.github.com> Date: Wed, 16 Sep 2020 14:42:14 -0700 Subject: [PATCH] Update pose_decode.py --- src/pose_decode.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/pose_decode.py b/src/pose_decode.py index e760054..320d72f 100644 --- a/src/pose_decode.py +++ b/src/pose_decode.py @@ -8,10 +8,24 @@ heatmap_width = 92 heatmap_height = 92 """ +Joints Explained 14 joints: 0-right shoulder, 1-right elbow, 2-right wrist, 3-left shoulder, 4-left elbow, 5-left wrist, 6-right hip, 7-right knee, 8-right ankle, 9-left hip, 10-left knee, 11-left ankle, 12-top of the head and 13-neck + + 12 + | + | + 0-----13-----3 + / / \ \ + 1 / \ 4 + / / \ \ + 2 6 9 5 + | | + 7 10 + | | + 8 11 """ JOINT_LIMB = [[0, 1], [1, 2], [3, 4], [4, 5], [6, 7], [7, 8], [9, 10], [10, 11], [12, 13], [13, 0], [13, 3], [13, 6], [13, 9]] @@ -19,10 +33,12 @@ COLOR = [[0, 255, 255], [0, 255, 255],[0, 255, 255],[0, 255, 255],[0, 255, 0],[0 def decode_pose(heatmaps, scale, image_original): - #obtain joint list from heatmap + # obtain joint list from heatmap + # joint_list: a python list of joints, joint_list[i] is an numpy array with the (x,y) coordinates of the i'th joint (refer to the 'Joints Explained' in this file, e.g., 0th joint is right shoulder) joint_list = [peak_index_to_coords(heatmap)*scale for heatmap in heatmaps] + - #plot the pose on original image + # plot the pose on original image canvas = image_original for idx, limb in enumerate(JOINT_LIMB): joint_from, joint_to = joint_list[limb[0]], joint_list[limb[1]]