kodokan.pose#
Body-pose estimation: a video → a sequence of per-person skeletal keypoints.
A single estimate_poses() facade with a pluggable, multi-person backend
(rtmlib = RTMPose top-down, default; or ultralytics = YOLO11-pose). Both
emit the COCO-17 keypoint layout, so downstream code is backend-agnostic.
Judo throws involve two people in close contact, so the default keeps the
n_persons highest-confidence detections per frame and orders them left→right
(a crude tori/uke proxy that is good enough for visualization and for the first
“compare two demos” experiments; true identity tracking through the occluded
apex of a throw is a separate, harder problem — see misc/docs/research-architecture.md).
Output is a PoseSequence: an (F, P, 17, 3) array (x, y, confidence;
NaN where a person slot is empty in that frame), plus the frame indices, fps,
and source provenance.
Module Attributes
COCO-17 keypoint names, in index order. |
|
COCO-17 skeleton edges (pairs of keypoint indices) for drawing/connections. |
Functions
|
Estimate per-frame, per-person COCO-17 keypoints for a video clip. |
Classes
|
A per-frame, per-person sequence of COCO-17 keypoints for one clip. |
- kodokan.pose.COCO17_KEYPOINTS: tuple[str, ...] = ('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')#
COCO-17 keypoint names, in index order.
- kodokan.pose.COCO17_SKELETON: tuple[tuple[int, int], ...] = ((5, 7), (7, 9), (6, 8), (8, 10), (5, 6), (5, 11), (6, 12), (11, 12), (11, 13), (13, 15), (12, 14), (14, 16), (0, 1), (0, 2), (1, 3), (2, 4), (0, 5), (0, 6))#
COCO-17 skeleton edges (pairs of keypoint indices) for drawing/connections.
- class kodokan.pose.PoseSequence(keypoints, frame_indices, fps, width, height, backend, video_path, source_url=None, keypoint_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'), skeleton=((5, 7), (7, 9), (6, 8), (8, 10), (5, 6), (5, 11), (6, 12), (11, 12), (11, 13), (13, 15), (12, 14), (14, 16), (0, 1), (0, 2), (1, 3), (2, 4), (0, 5), (0, 6)))[source]#
Bases:
objectA per-frame, per-person sequence of COCO-17 keypoints for one clip.
- keypoints#
(F, P, 17, 3)float array of (x_px, y_px, confidence);NaNfor empty person slots.- Type:
ndarray
- frame_indices#
(F,)int array of source frame indices analyzed.- Type:
ndarray
- width, height
Source frame dimensions in pixels.
- kodokan.pose.estimate_poses(video_path, *, backend='rtmlib', n_persons=2, conf_thresh=0.3, frame_step=1, frame_range=None, device=None, source_url=None, progress=True, **backend_kwargs)[source]#
Estimate per-frame, per-person COCO-17 keypoints for a video clip.
Simplest use:
estimate_poses("clip.mp4")→ aPoseSequencewith the two highest-confidence people per frame (left→right ordered) via RTMPose.- Parameters:
backend (
str) –"rtmlib"(RTMPose top-down, CPU/ONNX; default, and the only one installed bykodokan[pose]) or"ultralytics"(YOLO11-pose, MPS), which needskodokan[track]— an AGPL-3.0-or-later dependency, see the README’s “Licensing of extras”.n_persons (
int) – Number of person slots to keep per frame (2 for tori+uke).conf_thresh (
float) – Minimum mean per-person confidence to keep a detection.frame_step (
int) – Analyze everyframe_step-th frame (1 = every frame).frame_range (
tuple[int,int] |None) – Optional(start, stop)frame index window.device (
str|None) – Backend device ("cpu"/"mps"); backend default ifNone.source_url (
str|None) – Canonical source URL to record as provenance.progress (
bool) – Print a progress line periodically.**backend_kwargs – Forwarded to the backend (e.g.
mode="performance"for rtmlib, ormodel_name="yolo11m-pose.pt"for ultralytics).
- Return type:
- Returns:
A
PoseSequenceof shape(F, n_persons, 17, 3).