Nodes/comfyui_scail2_multi_cond/SCAIL-2 Align Reference Face To Crop
ComfyUI Node

SCAIL-2 Align Reference Face To Crop

Align your face reference to the crop so SCAIL-2's detail pass actually matches

By TTPlanetPig·Created 2 months ago·Updated 2 months ago· 143
SCAIL-2 Align Reference Face To Crop
  • face_crop_video
  • reference_image
  • aligned_reference_image
  • debug_preview
  • summary
target_frame_index0
face_scale1.00
x_offset_ratio0.000
y_offset_ratio0.000
face_size_basisbbox_width
target_face_selectcenter
reference_face_selectlargest
padding_modeedge
insightface_modelbuffalo_l
providerauto
det_size640
face_detector_backendauto
mediapipe_model_selectionfull_range
mediapipe_min_detection_confidence0.50
window_fit_modeshift_inside_reference

The second-pass trick for fixing SCAIL-2's drifting faces works a lot better when the reference image you give it actually lines up with the crop it's trying to reproduce. That's the insight behind this node: SCAIL-2 Align Reference Face To Crop detects the face in your first crop frame, detects the face in your high-res reference image, and builds a new reference whose face position and face size match the crop - so the detail pass starts from a reference that already looks like the shot instead of a random headshot the model has to reconcile.

It was added to the pack specifically because a community member (the README credits Aiwu/爱屋) noticed the second-pass face-detail video is far more stable when the high-res reference is aligned to the crop first. You connect the crop video from SCAIL-2 Head Track Crop as face_crop_video, your high-res face image as reference_image, and it outputs aligned_reference_image, which you then wire into the second scheduler as reference_N. There's also a debug_preview and a summary string describing what it did.

The key design choice is that it does not shrink your reference to crop resolution. It crops the reference at its original pixel density, so you keep every detail your high-res image has. window_fit_mode controls the edge behavior: the default shift_inside_reference moves the computed crop window back inside the reference image whenever it fits, so a large-enough reference gets no artificial padding at all; padding is used only when the requested window is bigger than the reference, or if you pick strict_alignment to preserve exact relative face placement. The practical result: alignment without upscaling, which is exactly what you want for a face detail pass.

The detector is where the install requirements creep in. face_detector_backend defaults to auto, which tries InsightFace first and falls back to MediaPipe if InsightFace isn't installed or fails. For the strongest detection, install InsightFace:

python -m pip install insightface onnxruntime-gpu   # CUDA; use onnxruntime for CPU

with insightface_model set to buffalo_l (default) or buffalo_s for the smaller model. The simplest path is MediaPipe, which uses its built-in face detection and needs no separate model file:

python -m pip install mediapipe

The MediaPipe-specific knobs (mediapipe_model_selection, mediapipe_min_detection_confidence) only matter on that backend, and provider (auto/cuda/cpu), det_size, and insightface_model only matter on InsightFace. If you don't have either library installed, auto falls back gracefully to MediaPipe - but you need at least one of them for this node to do anything.

The manual tuning controls are for small corrections only: face_scale (default 1.0; above 1.0 makes the reference face larger in the output window, below makes it smaller), x_offset_ratio and y_offset_ratio (fine position nudges, ±0.5), face_size_basis (bbox_width or bbox_height), and padding_mode (edge, reflect, black, white, mean) for the edges. target_face_select (center default) and reference_face_select (largest default) pick which face to use when a frame has more than one. target_frame_index selects which frame of the crop video is the alignment target - frame 0 by default, and usually that's the right one.

Install for the node itself is the pack standard (ComfyUI Manager search comfyui_scail2_multi_cond, or clone into custom_nodes and restart) - the extra step is the detector package above, which is the one place this pack has any real Python dependency.

Where people get burned: nothing about alignment fixes a bad reference, and nothing about it fixes SCAIL-2's underlying face drift. What it does is remove a controllable mismatch - wrong face size and position - so the detail pass isn't fighting geometry before it starts. For a single face used across the whole clip, point every segment at reference 1 and align once.

CategorySCAIL-2/Scheduled/Face Detail

Inputs (17)

NameTypeDefaultDescription
face_crop_videoIMAGE
reference_imageIMAGE
target_frame_indexINT00–999999
face_scaleFLOAT1.000.25–4
x_offset_ratioFLOAT0.000-0.5–0.5
y_offset_ratioFLOAT0.000-0.5–0.5
face_size_basisCOMBObbox_width2 options: bbox_width, bbox_height
target_face_selectCOMBOcenter2 options: center, largest
reference_face_selectCOMBOlargest2 options: largest, center
padding_modeCOMBOedge5 options: edge, reflect, black, white, mean
insightface_modelCOMBObuffalo_l2 options: buffalo_l, buffalo_s
providerCOMBOauto3 options: auto, cuda, cpu
det_sizeINT640160–2048
face_detector_backendCOMBOauto3 options: auto, insightface, mediapipe
mediapipe_model_selectionCOMBOfull_range2 options: full_range, short_range
mediapipe_min_detection_confidenceFLOAT0.500.01–0.99
window_fit_modeCOMBOshift_inside_reference2 options: shift_inside_reference, strict_alignment

Outputs (3)

NameTypeDescription
aligned_reference_imageIMAGE
debug_previewIMAGE
summarySTRING