Update pose_decode.py

This commit is contained in:
ascendhuawei
2020-09-16 14:42:14 -07:00
committed by GitHub
parent 43c3ed11a2
commit adff8450af
+16
View File
@@ -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]]
@@ -20,8 +34,10 @@ 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
# 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
canvas = image_original
for idx, limb in enumerate(JOINT_LIMB):