Nodes/tri3d-comfyui-nodes/Save Flattened Pose Keypoints as JSON File v5.1.0
ComfyUI Node

Save Flattened Pose Keypoints as JSON File v5.1.0

Turn any pack's POSE_KEYPOINT into a JSON file TRI3D's pipeline can read

By TRI3D-LC·Created 3 years ago·Updated about a year ago· 27
Save Flattened Pose Keypoints as JSON File v5.1.0
  • pose_kps
  • STRING
file_pathdwpose/keypoints/input.json

ComfyUI has a standard pose data type, POSE_KEYPOINT, and packs like ControlNet Aux and ComfyUI's own preprocessors emit it. TRI3D's pose pipeline, on the other hand, doesn't speak POSE_KEYPOINT - it works with flattened JSON files. This node is the adapter between those two worlds. You feed it a POSE_KEYPOINT from your favorite preprocessor, and it writes the flattened 130-keypoint JSON that tri3d-pose-to-image and tri3d-adjust-neck expect.

What it does

Two inputs: pose_kps (the standard OpenPose-style dict - people, canvas_width, canvas_height) and file_path, defaulting to dwpose/keypoints/input.json. It flattens the first detected person's keypoints into one ordered list - 18 body, 70 face, 21 left hand, 21 right hand - using the confidence score to decide validity: any point with confidence zero becomes [-1, -1], so nothing renders where nothing was detected. If no person was found at all, it writes 130 invalid markers rather than failing. The output is the STRING path the JSON was saved to.

The output format is exactly what the rest of the pack reads: {"height": ..., "width": ..., "keypoints": [...]}. That STRING plugs straight into tri3d-pose-to-image's pose_json_file input.

A couple of practical notes:

  • The path is relative to the pack's install folder, so dwpose/keypoints/input.json lives inside custom_nodes/tri3d-comfyui-nodes/. Same default as the pack's own DWPose node, which means the two can share a file.
  • It's an output node (OUTPUT_NODE is true), so it terminates a branch of the graph - don't expect it to pass anything onward.
  • Batch poses are saved as a JSON array; a single pose is saved as the object itself.

Why you'd bother

The obvious use is the DWPose node's JSON side effect without being locked into the pack's own detector. If you prefer ControlNet Aux's faster or CUDA-backed DWPose, you can take its POSE_KEYPOINT, run it through this node, and then use the whole TRI3D pose-adaptation stack - tri3d-adjust-neck, pose adaption, tri3d-pose-to-image - as if you'd detected with the pack's own node. It also decouples detection from adaptation: detect once, save the JSON, and you can iterate on neck scaling or pose locking offline without re-running detection every time.

Installing

Same pack, same drill - ComfyUI Manager (search "tri3d") or:

cd ComfyUI/custom_nodes
git clone https://github.com/TRI3D-LC/tri3d-comfyui-nodes

Restart, install requirements if Manager didn't (pip install -r custom_nodes/tri3d-comfyui-nodes/requirements.txt). No extra model downloads for this node - it's pure data shuffling, no inference.

Troubleshooting

  • "people" is empty / all [-1, -1] - the preprocessor genuinely found nobody. Not a bug; check your source image.
  • JSON writes but pose-to-image still complains - make sure the path you typed matches where the file was actually written, remembering the pack-relative resolution.
  • Wrong shape errors downstream - confirm you fed a real POSE_KEYPOINT (the standard type), not a raw image.

It's a small utility, but it's the hinge that lets you use the TRI3D pose tools with the preprocessor you already trust.

CategoryControlNet Preprocessors/Pose Keypoint Postprocess

Inputs (2)

NameTypeDefaultDescription
pose_kpsPOSE_KEYPOINT
file_pathSTRINGdwpose/keypoints/input.json

Outputs (1)

NameTypeDescription
STRINGSTRING