Yolo Pose Estimation and Skeleton: Difference between revisions
From wikiluntti
(→Yolo) |
(→Yolo) |
||
Line 18: | Line 18: | ||
* (x, y) coordinates for each keypoint and | * (x, y) coordinates for each keypoint and | ||
* confidence scores indicating the model’s certainty in each keypoint’s position. | * confidence scores indicating the model’s certainty in each keypoint’s position. | ||
=== Image detection === | |||
<syntaxhighlight lang="python"> | |||
from ultralytics import YOLO | |||
import matplotlib.pyplot as plt | |||
import cv2 | |||
from PIL import Image | |||
model = YOLO("yolo11n-pose.pt") # n, s, m, l, x versions available | |||
results = model.predict(source="sample_image.jpg") | |||
plt.figure(figsize=(10, 10)) | |||
plt.title('YOLOv11 Pose Results') | |||
plt.axis('off') | |||
plt.imshow(cv2.cvtColor(results[0].plot(), cv2.COLOR_BGR2RGB)) | |||
</syntaxhighlight> | |||
=== Pose to skeleton === | |||
=== === | |||
== Images == | == Images == |
Revision as of 20:45, 5 October 2025
Introduction
Make a pose estimator and use it to make a moving skeleton.
Use Yolo from Ultralytics.
- Python 3.7+
- Yolo v11
- A CUDA-enabled GPU (optional but recommended for faster inference).
pip install ultralytics opencv-python numpy
Yolo
There are 17 keypoints. YOLOv11’s pose model outputs:
- (x, y) coordinates for each keypoint and
- confidence scores indicating the model’s certainty in each keypoint’s position.
Image detection
from ultralytics import YOLO
import matplotlib.pyplot as plt
import cv2
from PIL import Image
model = YOLO("yolo11n-pose.pt") # n, s, m, l, x versions available
results = model.predict(source="sample_image.jpg")
plt.figure(figsize=(10, 10))
plt.title('YOLOv11 Pose Results')
plt.axis('off')
plt.imshow(cv2.cvtColor(results[0].plot(), cv2.COLOR_BGR2RGB))