Nodes/ComfyUI/SDPose Face Bounding Boxes
ComfyUI Node Runs on cloud

SDPose Face Bounding Boxes

Face crops from pose data, ready to feed back into the extractor

By Comfy-Org·Created 4 years ago·Updated 20 days ago· 121,575
SDPose Face Bounding Boxes
  • keypoints
  • bboxes
scale1.5
force_squaretrue

Here's the quiet secret of pose extraction: running a whole-body pose model on a full image is the imprecise way to do it. Pose models are trained on crops, and they're dramatically more accurate when you feed them a tight region around one person - or one face - instead of a crowded scene. SDPoseFaceBBoxes is the node that sets that up: it reads face keypoints from the pose data you already extracted and hands back bounding boxes around each face, formatted for exactly one purpose - feeding them straight back into SDPoseKeypointExtractor's bboxes input.

It's a loop node in the best sense. Extract pose once (full image, one person), get face boxes, extract again per-crop (accurate, multi-person), and the second pass's keypoints are the ones worth keeping. If you're doing anything face-focused - face ControlNet, face swaps, face detailing - this two-pass dance is the reliable pattern, and this node is the glue.

How it works

Each person in the OpenPose frame carries face_keypoints_2d - 70 points: 68 facial landmarks plus the two eyes. The node takes those absolute-pixel coordinates, computes the tight bounding box that encloses the face points, then applies two adjustments. scale multiplies the box area around the face - the default 1.5 is deliberate, because the bare landmark box hugs the face too tightly and a little margin makes the crop far more useful downstream. force_square (on by default) expands the shorter axis so the crop is always square, which matters because most face models expect roughly square input and stretching a non-square crop distorts the geometry you're trying to preserve.

The inputs and outputs that matter

  • keypoints - POSE_KEYPOINT from SDPoseKeypointExtractor. Required.
  • scale - 1.0 to 10.0, default 1.5. Bigger = more context around the face; too big starts pulling in background.
  • force_square - default on. Turn it off if you'd rather keep the natural aspect ratio.

The bboxes output is per frame and explicitly documented as compatible with the extractor's bboxes input - that's the designed handoff. Wire SDPoseKeypointExtractorSDPoseFaceBBoxesSDPoseKeypointExtractor, and the second extractor pass runs one crop per face instead of one full-image pass.

The catch to remember

The box is derived from keypoints, so it inherits every limitation of the first extraction. If the first pass only found one person (the full-image default), you only get one face box no matter how many faces are in the shot. And if a face is at an extreme angle or badly occluded, the landmarks are sparse and the resulting box can be off - a box that clips half the face gives the second pass a worse crop than the first pass gave you. When the two-pass loop isn't beating the single pass, the usual fix is a better detector upstream, not more iteration on the crop.

For most pose-ControlNet work you can skip this entirely - SDPoseDrawKeypoints is the endpoint you actually need. Reach for this node when faces are the point, not the whole body.

Categoryimage/detection

Inputs (3)

NameTypeDefaultDescription
keypointsPOSE_KEYPOINT
scaleFLOAT1.51–10Multiplier for the bounding box area around each detected face.
force_squareBOOLEANtrueExpand the shorter bbox axis so the crop region is always square.

Outputs (1)

NameTypeDescription
bboxesBOUNDING_BOXFace bounding boxes per frame, compatible with SDPoseKeypointExtractor bboxes input.