Face Segmentation
A mask shaped like an eye, not a box around one
- analysis_models
- image
- mask
- image
- seg_mask
- seg_image
- x
- y
- width
- height
Face Bounding Box gets you a rectangle. Face Segmentation gets you a shape - a mask that actually follows the outline of the face, or just the eyes, or just the mouth, instead of a box that inevitably grabs some background and hair along with it. If you're masking for an inpaint pass and a rectangular crop keeps roping in stuff you didn't want touched, this is the node that fixes it.
What it's for
Targeted inpainting is the obvious use: mask just the eyes to fix a weird generation without disturbing the rest of the face, or mask "mouth" to fix a bad smile, or grab the whole "face" region as a shaped mask instead of a box before running a detail pass. It's the same landmark-based idea Face Bounding Box uses, just returning a region outline instead of a bounding rectangle - closer to what a proper face-parsing segmentation model gives you, minus the extra weight of running one.
The inputs
- analysis_models (
ANALYSIS_MODELS) - from Face Analysis Models, as always. - image (
IMAGE) - the source image. - area - this is the real decision here, an 8-way enum:
face,main_features,eyes,left_eye,right_eye,nose,mouth, orface+forehead (if available). Pick the smallest region that covers what you actually need to change - a tighter mask means less of the image gets touched by whatever comes after. - grow (INT) - expand or shrink the mask uniformly.
- grow_tapered (BOOLEAN, default false) - grows the mask with a taper instead of a hard uniform expansion, which blends more naturally into a compositing or inpaint step. Flip this on when you notice a visible seam at the mask edge with plain
grow. - blur (INT, default 13) - softens the mask edge. Higher values feather more.
The outputs - you get both worlds
This is the node's real advantage over Face Bounding Box: it hands back both a full-image mask and a cropped-to-region version, so you don't have to choose upfront.
- mask / image - the mask and source image at full original size, region highlighted in place. Use these when you're compositing back into the same image.
- seg_mask / seg_image - the same thing, but cropped tight to the segmented region. Use these when you want to work on just that piece (say, run a small detail pass on cropped eyes) before pasting back.
- x, y, width, height - the box coordinates of the segmented region, for exactly that paste-back step.
Installing it
- ComfyUI Manager - search "Face Analysis for ComfyUI", install, restart.
- Manual -
cd ComfyUI/custom_nodes && git clone https://github.com/cubiq/ComfyUI_FaceAnalysis, restart.
Nothing extra to download for this node - it depends entirely on whichever backend (InsightFace, AuraFace, or Dlib) you set up in Face Analysis Models, and the landmark quality of that backend is what limits how precise the segmentation can get.
Common issues
face+forehead (if available) is the one to watch - the "if available" is doing real work in that label. Forehead landmarks aren't something every backend returns; Dlib's 81-point model has them, its own 68-point model doesn't, and whether InsightFace or AuraFace give you a usable forehead region depends on the model you're running. If you pick this option and get a mask that looks identical to plain face, that's your backend quietly not having the extra points rather than a bug. The other common trip-up is choosing main_features when you actually wanted just face, or vice versa - main_features is a tighter region (eyes/nose/mouth cluster) than the full face outline, so if your inpaint mask looks smaller than expected, check you didn't grab the wrong enum value. And if edges look harsh after compositing, that's almost always a blur or grow_tapered setting worth raising before you assume the segmentation itself is off.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| analysis_models | ANALYSIS_MODELS | — | |
| image | IMAGE | — | |
| area | COMBO | 8 options: face, main_features, eyes, left_eye, right_eye, nose, +2 | |
| grow | INT | 0-4096–4096 | — |
| grow_tapered | BOOLEAN | false | — |
| blur | INT | 131–4096 | — |
Outputs (8)
| Name | Type | Description |
|---|---|---|
| mask | MASK | — |
| image | IMAGE | — |
| seg_mask | MASK | — |
| seg_image | IMAGE | — |
| x | INT | — |
| y | INT | — |
| width | INT | — |
| height | INT | — |