Nodes/ComfyUI-CustomNodeKit/Estimate Yaw (Advanced)
ComfyUI Node

Estimate Yaw (Advanced)

Figure out which way your character is facing, every frame

By user2318·Created 4 months ago·Updated about a month ago· 56
Estimate Yaw (Advanced)
  • pose_keypoints_segment
  • pose_keypoints_full
  • yaw_array
  • yaw_table
  • yaw_json
conf_threshold0.30
unwrap_anglefalse
shoulder_weight0.70
enable_smoothingtrue
front_back_separatetrue
enable_front_weight_attenuationtrue
front_atten_threshold75
ear_min_angle5
nose_min_angle5

When your character turns around mid-video, the model needs to know - because that's the moment it should be feeding from a side-profile reference instead of the front shot. Yaw, the angle the body is facing, is the signal that makes that possible, and Estimate Yaw (Advanced) is the pack's full-strength estimator: it reads a pose sequence and returns one yaw angle per frame. It's the brain behind ReferenceImageSelector (choosing reference angles) and Draw SDPose Keypoints V2 (thickness + occlusion), and it's the "Advanced" version because every dial is on the table.

The method is a geometric estimate from the skeleton: shoulder width relative to torso height gives the angle magnitude (a front-facing person has wide shoulders, a side profile has none), and ear/nose positions give the sign (left vs right). It's clever but it's an estimate, which is why there's a "Simple" sibling with fewer knobs - start there if you don't want to think about it, come here when you need control.

What you set

  • pose_keypoints_segment - the pose sequence to analyze (required).
  • conf_threshold (0.3) - ignore low-confidence keypoints.
  • shoulder_weight (0.7) - how much to trust the shoulder-width signal vs. facial cues. Lower it if the face is consistently detected better than the body.
  • enable_smoothing (true) - 5-frame sliding window so the yaw doesn't twitch between frames. This is your jitter killer.
  • front_back_separate (true) - separate front/back baselines so a back-facing subject reads as ~180° rather than as a confusing near-0°.
  • enable_front_weight_attenuation (true) - reduces ear/nose influence when facing near-front, to stop the sign from flipping back and forth. Leave it on.
  • front_atten_threshold (75°), ear_min_angle (5°), nose_min_angle (5°) - tuning for when the sign flipping happens.
  • unwrap_angle - whether to allow angles to run past ±180° continuously (for spins).

Outputs: yaw_array (a FLOAT tensor, one value per frame - wire this into the draw/reference nodes), yaw_table (a readable debug table for sanity-checking), and yaw_json (the same data as a JSON string for saving or external use).

When you'd reach for it

This is the node that makes the pack's "character turns around and stays consistent" workflows work: yaw out → ReferenceImageSelector picks the matching reference, Draw SDPose Keypoints V2 renders the skeleton with perspective-correct thickness. In a dance where the subject spins, unwrap_angle keeps the yaw continuous through the turn so the downstream selector doesn't see a sudden -180°/180° cliff.

Install

Part of user2318/ComfyUI-CustomNodeKit. ComfyUI Manager: search "CustomNodeKit". Or:

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

then restart. Pure math on keypoints - no models beyond whatever produced the pose data.

The gotcha

It's a heuristic, and the failure modes are the ones the knobs exist to fix. A low-confidence or empty frame (person exits frame, detector fails) produces a garbage yaw spike - the pack's fix_empty_frames feature in the JSON load/resample nodes is your first line of defense, and smoothing covers the rest. The classic sign flip (character turns left, reads as right) is the enable_front_weight_attenuation / ear_min_angle / nose_min_angle trio - if you see it, that's where to tune. And read yaw_table on a short test clip before trusting it in a 40-minute generation: a yaw sequence that's 90° off at the wrong moment means your reference selector is feeding the model the wrong face.

CategorySDPose

Inputs (11)

NameTypeDefaultDescription
pose_keypoints_segmentPOSE_KEYPOINT
conf_thresholdFLOAT0.300–1
unwrap_angleBOOLEANfalse
shoulder_weightFLOAT0.700–1
enable_smoothingBOOLEANtrue是否启用比率时序平滑(5帧滑动窗口)。Whether to enable ratio temporal smoothing (5-frame sliding window).
front_back_separateBOOLEANtrue前/背身分离基准,背身角度更接近180°。Front/back separate baseline, back angles closer to 180°.
enable_front_weight_attenuationBOOLEANtrue正面范围削弱耳/鼻信号权重,防止符号误翻转。Attenuate ear/nose signal weights in front-facing range to prevent sign flipping.
front_atten_thresholdFLOAT7520–120正面权重衰减阈值(°)。Front weight attenuation threshold (°).
ear_min_angleFLOAT50–30耳信号启用最小角度(°),小于此忽略。Minimum angle for ear signal activation (°); ignored below this.
nose_min_angleFLOAT50–30鼻信号启用最小角度(°)。Minimum angle for nose signal activation (°).
pose_keypoints_fulloptPOSE_KEYPOINT

Outputs (3)

NameTypeDescription
yaw_arrayFLOAT
yaw_tableSTRING
yaw_jsonSTRING