Pose Keypoints to Points (JSON)
Pick a body part, get the keypoints as SAM2-ready JSON
- keypoints
- points_json
Pose detection hands you a skeleton - 17 keypoints in the COCO topology, from nose down to ankles. That's genuinely useful data, but it's also just a pile of coordinates. AnotherPoseToPoints is the filter that turns those coordinates into targeted point prompts: pick face, shoulders, elbows, whatever, and get back the JSON ready to feed a SAM2 node.
This is the node that makes "segment the person's face" or "cut out just the torso" a dropdown choice instead of a coordinates scavenger hunt. You run pose inference once, select the body region you care about (shoulders, wrists, face, one specific eye...), and the right keypoints flow out as prompt points for segmentation.
How it works
It takes keypoints in the standard COCO 17-point format and maps each body part name to its index in that topology (0 is nose, 5/6 are the shoulders, and so on). Then it does three things: resolves your body_part selection to a list of indices, filters out any keypoint that wasn't detected (the code skips coordinates that are 0,0 - the classic "not found" marker), and dumps the survivors as {"x": ..., "y": ...} JSON.
The body_part dropdown is where the value lives. Beyond the single joints, there are group aliases: eyes, ears, shoulders, elbows, wrists, hips, knees, ankles, plus face and upper_body convenience groups, and all for everything. If you want just one eye or one shoulder, there are per-side options too.
Inputs and outputs
keypoints(KEYPOINTS) - from a pose-capable detection node. In this pack,AnotherYOLOInferencewith a pose model (e.g.,yolov8n-pose.pt) outputs keypoints.body_part- the enum dropdown described above. Defaultall.- Output
points_json(STRING) - JSON array of points, ready forAnotherSAM2Inference.points_posor any other SAM2 point consumer.
One structural note: like the other adapters in this pack, it takes the first image's detections if you hand it a batch. Fine for single-image work; a silent limitation for batches.
Installing it
Part of the AnotherUtils pack:
cd ComfyUI/custom_nodes
git clone https://github.com/marcoc2/ComfyUI-AnotherUtils.git
Restart ComfyUI, or install via ComfyUI Manager (search "AnotherUtils"). To actually have keypoints you'll also want AnotherLoadYOLO with a -pose model - the ultralytics weights auto-download on first run into models/ultralytics, so there's no manual model hunting.
Gotchas
The undetected-keypoint filter is your friend but also a footgun: pose models only report joints they're confident about, and occluded limbs come back as 0,0 and get dropped. That's correct behavior - you don't want bogus points going into SAM2 - but it means a low-quality pose pass can silently produce far fewer points than you expected. If your segmentation is drifting, suspect the pose pass, not this node.
Also, keypoints are image coordinates, and they'll only line up with the SAM2 inference if the same image is feeding both. The classic failure: resize the image between the pose step and the segment step, and every point is now in the wrong space. Keep the resolution consistent and this node is a clean little bridge.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| keypoints | KEYPOINTS | — | |
| body_part | COMBO | all | 28 options: all, face, upper_body, nose, eyes, ears, +22 |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| points_json | STRING | — |