Nodes/ComfyUI-FaceChain/FC FaceSegment
ComfyUI Node

FC FaceSegment

Getting a clean face mask — FC FaceSegment and its two mask outputs

By THtianhao·Created 3 years ago·Updated about a year ago· 147
FC FaceSegment
  • source_image
  • warp_mask
  • seg_image
  • soft_mask
  • human_mask
ksize0.00
ksize10.00
include_neckfalse

FC FaceSegment is the mask-maker of ComfyUI-FaceChain. It runs a human-parsing segmentation model over an image and hands you the face mask, the full human mask, and the segmented image itself. If you've ever wanted a precise face region without hand-drawing a mask - for inpainting, compositing, or feeding a mask-op node - this is the one.

The engine is ModelScope's damo/cv_resnet101_image-multiple-human-parsing pipeline, which labels every region of a person in the image: face, hair, torso skin, clothes, and so on. That's a fundamentally different (and more useful) thing than a face-detection box. The face mask it produces follows the actual facial contour, which is what makes paste-back compositing look natural rather than boxy.

Inputs

  • source_image (IMAGE, required) - the photo to segment.
  • ksize (FLOAT, 0–1) and ksize1 (FLOAT, 0–1) - edge-expansion parameters. Per the README, they "expand the edges of the face" in the segmentation; bigger values grow the mask outward from the face boundary. Default 0 = tight mask.
  • include_neck (BOOLEAN, default off) - add the torso-skin (neck) region to the face mask. Useful when the swap should include the neck for continuity.
  • warp_mask (MASK, optional) - if provided, the dilated mask is multiplied against it. This is how you constrain the expansion to a region you already care about.

Outputs

Three of them, and the naming tells you which is which:

  • seg_image - the original image with the (expanded) face region kept and everything else zeroed out. Essentially a "face only" render.
  • soft_mask - the face mask (MASK), possibly expanded per ksize/include_neck. This is the one you wire into inpainting or compositing.
  • human_mask - the mask of the whole person (MASK), Gaussian-blurred for softer edges. Reach for this when you want the person, not just the face.

Where it fits

The classic pattern in this pack: FC FaceSegment's soft_mask feeds FC ReplaceByMask (to paste a generated face only inside the face region) or an inpainting setup. The human_mask is the right input for FC CropAndPaste, which expects the full person silhouette. If the mask looks too sharp at the edges, FC MaskOP (blur/erode/dilate) is the natural next step.

Install and gotchas

Standard pack install - ComfyUI Manager (search "ComfyUI-FaceChain") or clone into custom_nodes/ and restart. The segmentation model downloads from ModelScope on first use, so the first run is slow and needs access to modelscope.cn. The pack's startup dependency install (onnxruntime-gpu, mmdet, mmcv, modelscope, transformers…) applies pack-wide.

The honest gotcha: ksize and ksize1 both exist because the expansion math is sensitive, and the defaults are 0 for a reason - crank them too high and the mask swallows hair and ears. Also, if the model can't parse a face confidently (extreme angles, heavy occlusion), you'll get an empty mask and the node returns nothing useful. In that case, up the score threshold isn't an option - just use a face-detection box instead and accept the rougher edges.

Categoryfacechain/model

Inputs (5)

NameTypeDefaultDescription
source_imageIMAGE
ksizeoptFLOAT0.000–1
ksize1optFLOAT0.000–1
include_neckoptBOOLEANfalse
warp_maskoptMASK

Outputs (3)

NameTypeDescription
seg_imageIMAGE
soft_maskMASK
human_maskMASK