Nodes/ComfyUI-FLOAT_Optimized/Face Align for FLOAT (Ad)
ComfyUI Node

Face Align for FLOAT (Ad)

Fix the two things that silently ruin a talking head

By set-soft·Created about a year ago·Updated 12 months ago· 33
Face Align for FLOAT (Ad)
  • image
  • image
  • bboxes
face_margin1.6
rgba_conversionblend_with_color
bkg_color_hex#000000
size512
index1

FLOAT was trained on clean, square, 512×512 headshots with a sensible margin of space around the face. Your reference image is almost certainly not that. Face Align for FLOAT (Ad) is the preprocessing node that drags whatever you feed in toward what the model expects: it detects the face, crops to it with some breathing room, resizes the result to a square, and sorts out any transparency. If your talking head comes out with the face glued to the edge of the frame, head clipped mid-motion, or weird fringe artifacts, this node is the fix - and it's the same face_align=true behavior the one-button FLOAT Process (Opt) node does for you automatically.

The mechanism

Under the hood it uses face_alignment (yes, that's in the pack's requirements.txt) to find the face, then computes a square crop around it scaled by face_margin. The margin is a multiplier on the detected bounding box - 1.6 means the crop is 60% bigger than the box, which is exactly what the network trained with. That headroom is the whole point: the model generates head motion, and if there's no room to move, it has nowhere to put that motion. The crop is then resized to a square output (default 512).

Because it hands you the square crop rather than the original framing, it also gives you a bboxes output - one bounding box per input image (X, Y, W, H, where W and H are equal because it's square). That's your breadcrumb back: the advanced "Very Advanced Insert" workflows use it to paste the animated face back into the original photo after generation, so your subject stays in their original scene.

Inputs worth knowing

  • image - a batch is fine; each image gets its own crop.
  • face_margin (default 1.6, range 1.2–2.0) - more margin = wider shot, and a genuine quality dial. 1.6 is the trained sweet spot, but the README notes it sometimes artifacts the hair, and nudging this slightly is the documented remedy.
  • rgba_conversion (blend_with_color / discard_alpha / replace_with_color) and bkg_color_hex (default #000000) - for 4-channel RGBA input, e.g. from an Inspyrenet Rembg-style background-removal node. Blend is the sensible default; discard ignores alpha; replace paints fully transparent pixels with the color.
  • size (optional, default 512) - output square size; wire it from a loader's inferred_input_size if you're running at the model's native resolution.
  • index (optional, default 1) - which face to use when the image contains several. First face is 1.

The image output drops straight into FLOAT Encode Image to Latents (or Apply FLOAT Encoder in the VA graph).

Install & gotchas

Standard pack install - Manager search "ComfyUI-FLOAT_Optimized", or cd ComfyUI/custom_nodes && git clone https://github.com/set-soft/ComfyUI-FLOAT_Optimized && pip install -r requirements.txt, then restart. Note the dependency: face_alignment will pull a small face-detection model on first use; give it a moment.

The one thing to be careful about: this node crops, and cropping is lossy for FLOAT's purposes. If you enable it and then also use the bboxes output to reinsert the face, keep the margin and the crop resolution consistent between the two halves of the workflow, or your paste-back will be slightly misaligned. And if the image has no detectable face, the node has nothing to work with - feed it a proper headshot, not a landscape.

CategoryFLOAT/Advanced

Inputs (6)

NameTypeDefaultDescription
imageIMAGEInput image containing at least one face
face_marginFLOAT1.61.2–2Margin around the face, 1.6 means 60 % extra margin
rgba_conversionCOMBOblend_with_colorStrategy used to convert images with transparency
bkg_color_hexSTRING#000000Color used for the 'blend_with_color' and 'replace_with_color' strategies
sizeoptINT51264–1024Size for the square containing the face
indexoptINT11–14Which face to use when more than one is detected

Outputs (2)

NameTypeDescription
imageIMAGE
bboxesBBOX