Spaces:
Paused
Paused
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
@@ -19,7 +19,7 @@ def prepare_image(img_path):
|
|
19 |
# area in bounding_box below head (rectangular)
|
20 |
face_y1, face_h = face_bboxes[0][1], face_bboxes[0][2] #xywh of first face
|
21 |
face_y2 = face_y1 + face_h
|
22 |
-
body_box = body_bboxes.numpy().xyxy[0]
|
23 |
body_box[1] = face_y2 #shift below head
|
24 |
|
25 |
# Calculate the coordinates for cropping
|
|
|
19 |
# area in bounding_box below head (rectangular)
|
20 |
face_y1, face_h = face_bboxes[0][1], face_bboxes[0][2] #xywh of first face
|
21 |
face_y2 = face_y1 + face_h
|
22 |
+
body_box = body_bboxes.cpu().numpy().xyxy[0]
|
23 |
body_box[1] = face_y2 #shift below head
|
24 |
|
25 |
# Calculate the coordinates for cropping
|
pose.py
CHANGED
@@ -49,8 +49,8 @@ def detect_pose(src_img):
|
|
49 |
return results
|
50 |
|
51 |
def draw_pose(skeleton_image:Image.Image, keypoints, threshold=0.7, line_width = 3,circle_radius = 6):
|
52 |
-
coords = keypoints.numpy().xy[0]
|
53 |
-
scores = keypoints.data.squeeze()[:,2].numpy()
|
54 |
# Create a blank image with the same size as the input image
|
55 |
# skeleton_image = Image.new("RGB", im.size, "black") # White background
|
56 |
draw = ImageDraw.Draw(skeleton_image)
|
|
|
49 |
return results
|
50 |
|
51 |
def draw_pose(skeleton_image:Image.Image, keypoints, threshold=0.7, line_width = 3,circle_radius = 6):
|
52 |
+
coords = keypoints.cpu().numpy().xy[0]
|
53 |
+
scores = keypoints.data.squeeze()[:,2].cpu().numpy()
|
54 |
# Create a blank image with the same size as the input image
|
55 |
# skeleton_image = Image.new("RGB", im.size, "black") # White background
|
56 |
draw = ImageDraw.Draw(skeleton_image)
|