Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions utils/pose_utils.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import torch
import torch.nn as nn
import numpy as np
from PIL import Image
from PIL import Image, ImageDraw
from skimage.morphology import square, dilation, erosion
from utils import pose_transform
# import pose_transform
from utils import pose_transform # Ensure this is accessible
import json
from PIL import ImageDraw
from torchvision import utils, transforms
from skimage.draw import circle, line_aa, polygon
from skimage.draw import disk, line_aa, polygon

np.seterr(divide='ignore', invalid='ignore')

Expand Down Expand Up @@ -109,10 +107,10 @@ def draw_pose_from_cords(pose_joints, img_size, radius=6, draw_joints=True):
for i, joint in enumerate(pose_joints):
if pose_joints[i][0] == MISSING_VALUE or pose_joints[i][1] == MISSING_VALUE:
continue
yy, xx = circle(joint[0], joint[1], radius=radius, shape=img_size)
# 使用 disk 替代 circle
yy, xx = disk((joint[0], joint[1]), radius=radius, shape=img_size)
colors[yy, xx] = COLORS[i]
mask[yy, xx] = True

return colors, mask

def decode_labels(mask, num_images=1, num_classes=20):
Expand Down