脸部融合
The GAN-based face fusion node — model from a Baidu Pan link, quality worth the hoops
- template_image
- user_image
- 图片
FaceFusion (脸部融合) swaps a face onto a target image. You give it a template_image (the person whose body and scene you're keeping) and a user_image (whose face you want), and it fuses the source face's identity into the target. One node, no detection-to-inpaint chain, no control net. That's genuinely convenient for the "put my face on this generated character" class of work.
What's worth knowing up front: this is not the insightface/inswapper path most ComfyUI face swaps use (ReActor, Roop and friends all sit on that same 128x128 recognition backbone). This node drives a different engine - Alibaba's image_face_fusion model, a GAN-based (AEI-Net) face fusion network that reconstructs the face geometry rather than just pasting a low-res swap. It's a better identity fit for the "fuse this face into a new scene" job, and it's a different set of hoops: the model weights live behind a Baidu Pan link, not HuggingFace.
How it works
The node loads the fusion model from ComfyUI/models/image-face-fusion (expects pytorch_model.pt plus a face-recognition backbone inside the model folder), extracts the identity embedding from user_image, then regenerates the face region of template_image conditioned on that identity - while keeping the template's pose, expression and lighting as best the GAN can. It's batch-aware: it iterates over the template's batch dimension, so you can feed it a sequence of frames and fuse the same face across all of them, which is how people use it for short clips.
The two inputs are exactly what they sound like:
- template_image (IMAGE) - the target. The face here gets replaced.
- user_image (IMAGE) - the source. This face's identity gets fused in.
Output: 图片 (IMAGE), ready for a preview or save node.
Install - read this before anything else
The node code installs with the pack:
cd ComfyUI/custom_nodes
git clone https://github.com/yanlang0123/ComfyUI_Lam
But the model is the actual prerequisite, and it's not on HuggingFace - the README points at a Baidu Pan (Chinese cloud drive) link with an extraction code, to be unzipped into ComfyUI/models/image-face-fusion. If you're outside China, the Baidu Pan download can be slow or require an account; it's worth budgeting time for. The pack also asks you to extract its bundled insightface.rar into python_embeded\Lib\site-packages and run install.bat - for this node specifically, skip the .bat's heavy pinned deps (tensorflow 2.12, numpy 1.23.4) unless something actually errors; the fusion model mostly needs torch and its own weights.
Common issues
- "No such file pytorch_model.pt" - the model folder is empty or in the wrong place. The node looks in
models/image-face-fusion, and the Baidu Pan zip must be extracted there sopytorch_model.ptis directly inside. - Identity looks off - GAN fusion keeps the template's expression, so a radically different source expression won't transfer. That's the mechanism, not a bug.
- Faces on video frames jitter - batch fusion runs per-frame with no temporal consistency; expect some flicker on long clips.
- First run is slow - the model loads once per run and the GAN pass is heavier than an inswapper swap. Patience on the first call.
If your job is "replace the face, keep everything else pixel-identical," a detection-based swap (Roop/ReActor) is the safer bet. If it's "fuse a face into a new scene and look natural," this is the one - once you've survived the Baidu Pan download.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| template_image | IMAGE | — | |
| user_image | IMAGE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| 图片 | IMAGE | — |