How to Custom Pose Keypoint Detection and Connecting keypoint lines YoloV8-pose #5204
Jaykumaran
started this conversation in
Docs
Replies: 1 comment 4 replies
-
@Jaykumaran hello! It looks like you're working on custom pose keypoint detection and connecting keypoints with lines using YOLOv8-pose. To achieve this, you'll want to follow these steps:
Remember that the For more details on pose estimation and keypoint detection with YOLOv8, please refer to the Pose/Keypoint Estimation section in our documentation. Keep up the great work, and if you have further questions or need assistance, feel free to reach out! 😊🚀 |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
import matplotlib.pyplot as plt
from ultralytics import YOLO
from PIL import Image, ImageDraw
model = YOLO("C:\Users\jaikr\Downloads\Final\best.pt")
results = model.predict(source="C:\Users\jaikr\Downloads\Subset640\train\images\WIN_20230915_20_27_08_Pro.jpg")
for r in results:
print(r.keypoints)
keypoints = r.keypoints.xy.int().numpy() # get the keypoints
img_array = r.plot(kpt_line=True, kpt_radius=6) # plot a BGR array of predictions
im = Image.fromarray(img_array[..., ::-1]) # Convert array to a PIL Image
draw = ImageDraw.Draw(im)
draw.line([(keypoints[0][0][0], keypoints[0][0][1]), (keypoints[0][1][0],
keypoints[0][1][1]), (keypoints[0][2][0], keypoints[0][2][1])], fill=(0, 0,255), width=5)
im.show()
Beta Was this translation helpful? Give feedback.
All reactions