fffiloni commited on
Commit
bacee3c
·
1 Parent(s): 79cf760

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -70,6 +70,9 @@ def predict(img):
70
  "left_ankle": 15,
71
  "right_ankle": 16
72
  }
 
 
 
73
 
74
  # create a black image of the same size as the original image
75
  black_img = np.zeros((width, height, 3), np.uint8)
@@ -80,11 +83,11 @@ def predict(img):
80
  keypoints = person['keypoints']
81
 
82
  # draw lines between keypoints to form a skeleton
83
- skeleton = [("right_eye", "left_eye", (255,128,0)),("nose", "left_eye", (255,128,0)), ("left_eye", "left_ear", (255,128,0)), ("nose", "right_eye", (255,128,0)), ("right_eye", "right_ear", (255,128,0)),
84
- ("left_shoulder", "left_ear", (255,128,0)),("right_shoulder", "right_ear", (255,128,0)), ("left_shoulder", "right_shoulder", (255,128,0)), ("left_shoulder", "left_elbow", (0, 255, 0)), ("right_shoulder", "right_elbow",(51,153,255)),
85
- ("left_elbow", "left_wrist",(0, 255, 0)), ("right_elbow", "right_wrist",(51,153,255)), ("left_shoulder", "left_hip",(255,128,0)),
86
- ("right_shoulder", "right_hip", (255,128,0)), ("left_hip", "right_hip", (255,128,0)), ("left_hip", "left_knee",(0, 255, 0)),
87
- ("right_hip", "right_knee",(51,153,255)), ("left_knee", "left_ankle",(0, 255, 0)), ("right_knee", "right_ankle",(51,153,255))]
88
  for start_part, end_part, color in skeleton:
89
  start_idx = list(body_part.keys()).index(start_part)
90
  end_idx = list(body_part.keys()).index(end_part)
 
70
  "left_ankle": 15,
71
  "right_ankle": 16
72
  }
73
+ orange=(255,128,0)
74
+ blue=(51,153,255)
75
+ green=(0,255,0)
76
 
77
  # create a black image of the same size as the original image
78
  black_img = np.zeros((width, height, 3), np.uint8)
 
83
  keypoints = person['keypoints']
84
 
85
  # draw lines between keypoints to form a skeleton
86
+ skeleton = [("right_eye", "left_eye", orange),("nose", "left_eye", orange), ("left_eye", "left_ear", orange), ("nose", "right_eye", orange), ("right_eye", "right_ear", orange),
87
+ ("left_shoulder", "left_ear", orange),("right_shoulder", "right_ear", orange), ("left_shoulder", "right_shoulder", orange), ("left_shoulder", "left_elbow", green), ("right_shoulder", "right_elbow",blue),
88
+ ("left_elbow", "left_wrist",green), ("right_elbow", "right_wrist",blue), ("left_shoulder", "left_hip",orange),
89
+ ("right_shoulder", "right_hip", orange), ("left_hip", "right_hip", orange), ("left_hip", "left_knee",green),
90
+ ("right_hip", "right_knee",blue), ("left_knee", "left_ankle",green), ("right_knee", "right_ankle",blue)]
91
  for start_part, end_part, color in skeleton:
92
  start_idx = list(body_part.keys()).index(start_part)
93
  end_idx = list(body_part.keys()).index(end_part)