ComfyUI Node

FaceFusion PM

Ali's UNet or the classic inswapper

By THtianhao·Created 3 years ago·Updated 2 years ago· 201
FaceFusion PM
  • source_image
  • swap_image
  • IMAGE
mode

This is the node that actually swaps a face, and it gives you two different engines behind one mode dropdown. "FaceFusion PM" is a slightly generous name - this isn't the FaceFusion project - but what it does is straight up face replacement: take the face from one image, put it on the head in another, blend, done.

The two modes are genuinely different tools:

  • ali - a ModelScope UNet pipeline (damo/cv_unet-image-face-fusion_damo). This is the original EasyPhoto approach: source_image is the template (the body, scene, lighting you want to keep) and swap_image is the user's face. The network fuses them and returns the result with the new face baked into the template's pose and lighting.
  • roop - the classic inswapper path. This uses InsightFace's FaceAnalysis (buffalo_l) to detect and embed faces, then inswapper_128.onnx to do the pixel-level swap. It's the same backbone as ReActor and the original Roop, and the KB's identity-preservation essay covers that whole lineage - post-process swap, applied after generation rather than conditioning it.

The roop mode has one quirk worth knowing: it resizes any input larger than 640px on the short side down to 640 before swapping, then scales the result back up. The reason is that inswapper is a 128×128 model and needs a reasonably-sized face to work with. Practical upshot: don't expect crisp 4K detail from this path; expect a face that's been pasted, blended, and upscaled. If that's not good enough, run the output through PortraitEnhancement after.

Inputs are exactly three: source_image (where the face goes), swap_image (the face you want to use), and mode (ali or roop). One output, an IMAGE. Two behavioral notes from the source that will save you a confused debug session: in roop mode, if the swap image has no detectable face it doesn't error - it just returns the source image unchanged with a console warning, which looks exactly like "nothing happened." And it always uses the first face found in each image (faces[0]), so with multiple people in frame you don't get a choice here; you'd crop first with RetinaFace.

Install is the shared pack story: Manager or git clone https://github.com/THtianhao/ComfyUI-Portrait-Maker into custom_nodes, restart, and let the startup download finish - the inswapper_128.onnx (~530MB) comes down at that point into the pack's own models/ folder, and buffalo_l comes from InsightFace's model zoo on first use. The dependency list is heavy (tensorflow, onnx, modelscope, insightface, diffusers pinned to 0.18.2) and there's a bundled insightface-0.7.3 wheel for Windows Python 3.11, so give it a real install time.

One honest caveat from the licensing side: inswapper's weights and InsightFace models are non-commercial, so this node is fine for personal work but not something you'd bake into a paid product without reading those terms. And know where this sits in the modern stack - for "same person, new pose," generative tools like InstantID or PuLID have largely taken over; a swap like this is the tool you reach for when the image is already right and you just want a different face on it.

Categoryprotrait/model

Inputs (3)

NameTypeDefaultDescription
source_imageIMAGE
swap_imageIMAGE
modeCOMBO2 options: ali, roop

Outputs (1)

NameTypeDescription
IMAGEIMAGE