Nodes/ComfyUI-WanAnimatePreprocess/Pose and Face Detection
ComfyUI Node

Pose and Face Detection

Where your driving video becomes a skeleton and a face crop

By kijai·Created 11 months ago·Updated 3 months ago· 545
Pose and Face Detection
  • model
  • images
  • retarget_image
  • pose_data
  • face_images
  • key_frame_body_points
  • bboxes
  • face_bboxes
width832
height480
face_padding0

This is the heart of the WanAnimatePreprocess pack. You feed it a driving video - someone dancing, gesturing, whatever - and it turns that footage into the two things Wan Animate actually consumes: a per-frame skeleton description and clean face crops. Wan Animate, for the record, is Alibaba's motion-transfer model for Wan 2.2: you supply a reference character and a driving clip, and it re-performs the motion with the new character's body and face. The preprocess is where that whole trick gets set up, and this node does most of it.

It's from kijai, the same author behind ComfyUI-WanVideoWrapper, and in the wild it's the node people mean when they say "Kijai's WanAnimatePreprocess for face capture" in those group-dance remix workflows you see on r/comfyui. The example workflow bundled with the pack runs it right after a video loader, feeds its outputs into Draw ViT Pose and a SAM2 segmentation pass, and only then touches the Animate model.

How it works

Under the hood it runs the two models the loader gave it, in two passes per frame:

  1. YOLO finds the person, returning a bounding box.
  2. The box is cropped and resized to ViTPose's 256×192 input; ViTPose extracts whole-body keypoints (body, face, hands).
  3. Those keypoints become pose_data - the normalized skeleton every downstream node reads.

The clever part is retargeting. If you feed a retarget_image, the node runs the same detection on it, then rescales every limb of the driving skeleton to the reference character's proportions. That's how you make a 5'2" cartoon character dance with a real dancer's motion - the skeleton gets remapped onto the reference's bone lengths before the model ever sees it.

The inputs that matter

  • model - the POSEMODEL from ONNX Detection Model Loader.
  • images - your driving frames (load a video with VHS and pass the images).
  • width / height - the generation resolution, not the video's. Default 832×480, and it should match what you'll ask the Animate model for.
  • retarget_image - optional. A reference character image to remap the motion onto. Leave empty if you're just doing straight motion transfer.
  • face_padding - when > 0, detected faces get padded by this many pixels and resized to 512×512. Default 0 means faces are cropped tight, which can chop foreheads and chins.

What comes out, and where it goes

  • pose_data (POSEDATA) - wire this into Draw ViT Pose to render the skeleton images, or into Pose Retarget Prompt Helper if you're on the Flux Kontext path.
  • face_images (IMAGE) - 512×512 face crops, one per frame. These go to a SAM2 segmentation node to build a face mask.
  • key_frame_body_points (STRING) - a JSON list of body keypoints sampled across the clip, used as SAM2 point prompts for the body mask.
  • bboxes and face_bboxes (BBOX) - raw boxes, useful if you want to draw or filter masks yourself.

The workflow shape is basically: video → this node → Draw ViT Pose for pose images, and face/body keypoints + SAM2 for masks, then everything concats into the Animate model's inputs. The pack's example_workflows folder has the canonical version, and it's worth opening before you try to invent your own.

Real-world gotchas

Face crops can come out empty on fast-moving frames where the face keypoints land off-screen. The node handles it by logging a warning and substituting a fallback crop - your mask will be wrong on those frames, so keep face_padding at 16 or so to give faces margin.

Retarget quality depends on the reference. The community's standard advice when the result looks wrong: keep the reference and driving video at the same resolution and have the character face roughly the same direction. If your reference is a back view and your dancer faces forward, the retarget will fight itself.

The skeleton looks tiny or cropped after retargeting. That's what Draw ViT Pose's retarget_padding exists for - it makes room for the retargeted body when it gets resized back to the target frame.

CategoryWanAnimatePreprocess

Inputs (6)

NameTypeDefaultDescription
modelPOSEMODEL
imagesIMAGE
widthINT83264–2048Width of the generation
heightINT48064–2048Height of the generation
retarget_imageoptIMAGEOptional reference image for pose retargeting
face_paddingoptINT00–512When > 0, the detected face images are padded and resized to 512x512

Outputs (5)

NameTypeDescription
pose_dataPOSEDATA
face_imagesIMAGE
key_frame_body_pointsSTRING
bboxesBBOX
face_bboxesBBOX,