Nodes/Facefusion_comfyui/FF: Visualize Face Mask
ComfyUI Node

FF: Visualize Face Mask

See the mask before you commit to the swap

By huygiatrng·Created 9 months ago·Updated 25 days ago· 89
FF: Visualize Face Mask
  • face_data
  • IMAGE
mask_typeoccluder
face_occluder_modelxseg_1
face_parser_modelbisenet_resnet_34
process_modeall
face_index0
visualization_modeoverlay
overlay_alpha0.5

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 from FaceDetectorNode.
  • mask_type (default occluder) - occluder shows what the occlusion model would exclude (hands, hair, objects), parser shows the semantic region mask, combined shows both together.
  • face_occluder_model (default xseg_1) and face_parser_model (default bisenet_resnet_34) - whichever model backs the mask type you picked. Set either to none and that mask type has nothing to render.
  • visualization_mode (default overlay) - overlay at overlay_alpha (default 0.5) is the most readable for spotting problems; mask_only is cleaner for judging the mask's exact boundary.
  • process_mode (single / all, default all) and face_index - when your face_data holds more than one face, single plus a face_index lets 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.

CategoryFaceFusion

Inputs (8)

NameTypeDefaultDescription
face_dataFACE_DATA
mask_typeCOMBOoccluder3 options: occluder, parser, combined
face_occluder_modelCOMBOxseg_14 options: none, xseg_1, xseg_2, xseg_3
face_parser_modelCOMBObisenet_resnet_343 options: none, bisenet_resnet_18, bisenet_resnet_34
process_modeCOMBOall2 options: single, all
face_indexINT00–100
visualization_modeCOMBOoverlay3 options: heatmap, overlay, mask_only
overlay_alphaFLOAT0.50–1

Outputs (1)

NameTypeDescription
IMAGEIMAGE