Nodes/ComfyUI-WanVideoWrapper/Face Mask From Pose Keypoints
ComfyUI Node Runs on cloud

Face Mask From Pose Keypoints

Turn pose keypoints into a face mask

By kijai·Created about a year ago·Updated 2 months ago· 6,651
Face Mask From Pose Keypoints
  • pose_kps
  • MASK
person_index0

You already ran a pose estimator - DWPose or OpenPose - and got back keypoints for the people in your frame. This node reads those keypoints and draws a mask over one person's face. That's it, and that narrow job turns out to be genuinely handy: a face mask lets you focus control, protect or inpaint just the face, or isolate the head region for a talking-head pipeline, all without hand-painting a mask frame by frame. Since it's derived from pose keypoints, it tracks the face as it moves through a video.

It lives under the "ControlNet Preprocessors / Pose Keypoint Postprocess" category rather than the main WanVideoWrapper menu, because it's a postprocessing step on pose data - but it ships in the WanVideoWrapper pack and slots naturally into Wan face-driven workflows.

How it works

A pose estimator outputs keypoints, including facial landmarks (eyes, nose, jaw, and so on). This node takes that keypoint data, picks the person you specify, and builds a mask covering their face region from those landmarks. Because it's reading structured keypoints rather than doing its own detection, it's fast and deterministic - no second neural pass, just geometry from the points you already have.

The inputs and outputs that matter

  • pose_kps (POSE_KEYPOINT) - the keypoints from your DWPose/OpenPose preprocessor. This node is a consumer of pose data; you need a pose estimator upstream producing this.
  • person_index (default 0) - which person to mask, when the frame has more than one. 0 is the first detected person; bump it to target the second, third, etc. This is the knob you'll actually reach for in multi-person shots.

Output:

  • MASK - a mask over the chosen person's face, ready to feed anywhere a mask is accepted: an inpaint encode, a conditioning region, a compositing step.

How to install it

Ships in the WanVideoWrapper. ComfyUI Manager: search ComfyUI-WanVideoWrapper, install, restart. Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/kijai/ComfyUI-WanVideoWrapper
pip install -r ComfyUI-WanVideoWrapper/requirements.txt

then restart. This node itself doesn't download a model, but it's useless without a pose estimator feeding it keypoints - DWPose or OpenPose, typically from the ControlNet aux preprocessors, which come with their own detection weights.

Common issues & troubleshooting

Empty or wrong mask. Usually the keypoints. If the upstream pose estimator didn't detect the face (bad angle, motion blur, tiny subject), there are no facial landmarks to build a mask from. Check the raw pose output first.

Masking the wrong person. That's person_index. In a multi-person frame the ordering is whatever the estimator returned; try index 1, 2, and so on until you hit the right one. The order can shift between frames if people cross, which is a real limitation of keypoint-based selection.

Mask is too tight or too loose for your purpose. This node draws the face region from landmarks - if you need padding or feathering, run the output through a mask blur/grow node afterward rather than expecting this one to shape it.

CategoryControlNet Preprocessors/Pose Keypoint Postprocess

Inputs (2)

NameTypeDefaultDescription
pose_kpsPOSE_KEYPOINT
person_indexINT00–100Index of the person to start with

Outputs (1)

NameTypeDescription
MASKMASK