[YOLO] Pose Estimation 포즈 추정
AI, ML, DL 2026. 2. 7. 19:50 |반응형
YOLO를 이용해 포즈를 추정해 보자.
from ultralytics import YOLO
kpt_names = ["nose", "left_eye", "right_eye", "left_ear", "right_ear", "left_shoulder",
"right_shoulder", "left_elbow", "right_elbow", "left_wrist", "right_wrist",
"left_hip", "right_hip", "left_knee", "right_knee", "left_ankle", "right_ankle"]
model = YOLO("yolo26n-pose.pt") # "yolo26n-pose.pt"가 없다면 자동으로 다운로드 받는다
results = model("palvin1.png", save=True)
print(f"Length of results: {len(results)}")
# 1개의 이미지만 사용했으므로 results에는 1개의 원소만 있다
# Access the results
for result in results: # results에는 1개의 원소만 있기 때문에 for 루프를 사용하는 의미는 없다
xy = result.keypoints.xy # x and y coordinates
xyn = result.keypoints.xyn # normalized
kpts = result.keypoints.data # x, y, visibility (if available)
print(f"Number of people: {len(result)}")
for i, kpt in enumerate(kpts):
print(f"Confidence: {result.boxes.conf[i]}")
for name, k in zip(kpt_names, kpt):
if k[2] > 0.3: # k[2]: visibility
print(f"{name} is at {k}")
else:
print(f"{name} is not visible")
print()






※ 참고
반응형
'AI, ML, DL' 카테고리의 다른 글
| [YOLO] with OpenCV (0) | 2026.02.08 |
|---|---|
| [YOLO] YOLO models to ONNX 파일 변환 (0) | 2026.02.08 |
| [Gemini] Gemini API for Python and C# (0) | 2025.11.28 |
| [AI] 한국어 형태소 분석기 Kiwipiepy & 워드 클라우드 Word Cloud (0) | 2025.11.13 |
| [MediaPipe] Async Pose Landmark Detection 비동기 자세 특징 감지 (0) | 2025.02.12 |
