FF: Visualize Face Mask
See the mask before you commit to the swap
- face_data
- IMAGE
This node doesn't swap anything. It's a debug tool, and it exists to answer one question before you waste a run on AdvancedSwapFaceImage: what does this mask setting actually cover? Occlusion and region masks are model outputs - you can't eyeball what an XSeg or BiSeNet model is going to decide is "face" versus "hand" versus "hair" the way you can eyeball a simple rectangle. This node makes that visible.
It's telling that its mask_type field only offers three options: occluder, parser, and combined. Box and area masks - the two purely geometric mask types in AdvancedSwapFaceImage - aren't in the list, and that's not an oversight so much as a reasonable line to draw: a rectangle with blurred edges or a landmark-based area is easy to picture in your head, but a segmentation model's actual output isn't, which is exactly the kind of thing worth rendering before you trust it.
How it works
Feed it face_data from FaceDetectorNode, pick which mask type to inspect, and it renders the model's mask output over the face using whichever visualization_mode you choose - a heatmap, a semi-transparent overlay on the original image, or the raw mask on its own. It's a preview, not a commitment: nothing here feeds back into an actual swap, it's purely for dialing in settings before you use them on AdvancedSwapFaceImage or FaceSwapApplier.
Inputs and outputs that matter
face_data(FACE_DATA) - comes fromFaceDetectorNode.mask_type(defaultoccluder) -occludershows what the occlusion model would exclude (hands, hair, objects),parsershows the semantic region mask,combinedshows both together.face_occluder_model(defaultxseg_1) andface_parser_model(defaultbisenet_resnet_34) - whichever model backs the mask type you picked. Set either tononeand that mask type has nothing to render.visualization_mode(defaultoverlay) -overlayatoverlay_alpha(default 0.5) is the most readable for spotting problems;mask_onlyis cleaner for judging the mask's exact boundary.process_mode(single/all, defaultall) andface_index- when yourface_dataholds more than one face,singleplus aface_indexlets you inspect one specific detection instead of all of them at once.
Output is a single IMAGE.
Installing it
Via ComfyUI Manager: search Facefusion_comfyui. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/huygiatrng/Facefusion_comfyui.git
cd Facefusion_comfyui
pip install -r requirements.txt
Restart ComfyUI fully afterward. First use downloads whichever occluder/parser model you've picked into custom_nodes/Facefusion_comfyui/models/ - these are separate downloads from the swapper models, so expect a fetch the first time you touch this node even if you've already used the swap nodes.
Common issues
The mask looks empty or unchanged no matter what you set. Check that face_occluder_model / face_parser_model isn't set to none for the mask type you're trying to view - none is a valid choice on both fields and it means exactly what it says.
process_mode: single shows the wrong face, or nothing. face_index has to point at a face that actually exists in your upstream face_data. If FaceDetectorNode was set to face_selector_mode: one, there's only index 0 available.
Nodes missing after install, or an ONNX load error. Same install pitfalls as the rest of the pack: confirm pip install -r requirements.txt ran inside ComfyUI's own Python (portable Windows installs need python_embeded's pip specifically) and do a full restart, not a page refresh. A model that fails to load is almost always a partial or locked download - delete it from custom_nodes/Facefusion_comfyui/models/ and let it re-fetch.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| face_data | FACE_DATA | — | |
| mask_type | COMBO | occluder | 3 options: occluder, parser, combined |
| face_occluder_model | COMBO | xseg_1 | 4 options: none, xseg_1, xseg_2, xseg_3 |
| face_parser_model | COMBO | bisenet_resnet_34 | 3 options: none, bisenet_resnet_18, bisenet_resnet_34 |
| process_mode | COMBO | all | 2 options: single, all |
| face_index | INT | 00–100 | — |
| visualization_mode | COMBO | overlay | 3 options: heatmap, overlay, mask_only |
| overlay_alpha | FLOAT | 0.50–1 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |