Mask_FaceSegment
Masking individual facial features in ComfyUI
- images
- IMAGE
- MASK
Retouching just the lips, relighting just the eyes, or building a mask for a targeted inpaint that leaves the rest of the face alone - all of those need masking finer than "the whole face." Mask_FaceSegment is cardenluo's ComfyUI-Apt_Preset node for exactly that level of detail: a face-parsing model exposed as a checklist of facial features.
What it does
This wraps a SegFormer face-parsing model - the README names 1038lab/segformer_face as the download. Feed it an image, toggle on whichever of fifteen facial regions you want (Skin, Nose, Eyeglasses, Left-eye, Right-eye, Left-eyebrow, Right-eyebrow, Left-ear, Right-ear, Mouth, Upper-lip, Lower-lip, Hair, Earring, Neck), and it returns a combined mask of just those parts. Everything defaults off - you're building the mask up region by region, not trimming down from "whole face."
This is a finer-grained cousin of general background removal: where a background-removal model like BiRefNet or RMBG-2.0 gives you subject-versus-background as a single mask, a face-parsing model like this one classifies pixels within the subject itself into named anatomical regions - the same category of tool as the CelebAMask-style face taxonomies used elsewhere in the ecosystem for detail-preserving face edits.
Inputs and outputs
images- the input image (required).- Fifteen boolean toggles listed above, all optional, all default
false. background- fill for unselected regions:Alpha,white,black,green,red,blue, orgray.
Outputs: IMAGE (the composited result) and MASK (the combined selection). The mask is what you'll typically chain forward - into an inpaint step scoped to Mouth + Upper-lip + Lower-lip for a lip-only edit, say, or Left-eye + Right-eye for eye-specific work.
Toggle one or two related features at a time when you're first testing this node - Left-eye and Right-eye together, for instance - rather than flipping on everything at once, so a bad segmentation on one feature doesn't get lost in a busy combined mask.
Installing it
ComfyUI Manager: search ComfyUI-Apt_Preset. Manual install:
cd ComfyUI/custom_nodes
git clone https://github.com/cardenluo/ComfyUI-Apt_Preset.git
Run install.bat (Windows) or install requirements.txt yourself, restart ComfyUI.
This node needs a model file that isn't part of the base install. Grab 1038lab/segformer_face (or the pack's bundled resource pack, linked in the README) and place it at:
ComfyUI/models/Apt_File/segformer_face
Without it, the node has nothing to run inference with.
Troubleshooting
If the node doesn't show up at all, check for a pack-wide import failure before anything else - ComfyUI-Apt_Preset is large and there's a documented IMPORT FAILED report for it; the ComfyUI console at startup will show the real error if a dependency is missing.
If it loads but fails to run, check the Apt_File/segformer_face folder first - this is the most likely culprit given the model isn't auto-downloaded. And if the mask boundary looks rougher than you expected on features like Left-eyebrow or Earring, that's a limitation of the underlying model on small, thin regions rather than a setup mistake - small facial features are consistently the hardest case for this style of parsing model, the same way flyaway hair is the hardest case for general background removal.
Inputs (17)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| Skinopt | BOOLEAN | false | — |
| Noseopt | BOOLEAN | false | — |
| Eyeglassesopt | BOOLEAN | false | — |
| Left-eyeopt | BOOLEAN | false | — |
| Right-eyeopt | BOOLEAN | false | — |
| Left-eyebrowopt | BOOLEAN | false | — |
| Right-eyebrowopt | BOOLEAN | false | — |
| Left-earopt | BOOLEAN | false | — |
| Right-earopt | BOOLEAN | false | — |
| Mouthopt | BOOLEAN | false | — |
| Upper-lipopt | BOOLEAN | false | — |
| Lower-lipopt | BOOLEAN | false | — |
| Hairopt | BOOLEAN | false | — |
| Earringopt | BOOLEAN | false | — |
| Neckopt | BOOLEAN | false | — |
| backgroundopt | COMBO | Alpha | 7 options: Alpha, white, black, green, red, blue, +1 |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| MASK | MASK | — |