LayerMask: Mediapipe Facial Segment(Advance)
Pick exactly which facial features you want masked
- image
- image
- mask
Most face-masking tools give you one blob: "the face." MediapipeFacialSegment goes finer, using Google's Mediapipe face model to segment individual features - eyes, eyebrows, lips, teeth - as separate toggleable regions, and it lets you combine exactly the ones you want into a single output mask. Want to inpaint just the lips? Just eyes? Eyes and eyebrows together but leave the mouth alone? That's one node, six checkboxes.
This is a sibling to the pack's PersonMaskUltra nodes (whole-body region masking - face, hair, skin, clothing) but scoped down to facial detail specifically, and it shares the same Mediapipe model files.
The inputs and outputs that matter
Six boolean toggles, all default on:
left_eye/right_eyeleft_eyebrow/right_eyebrowlipstooth
Every feature is included by default - you're switching things off to narrow the result, not turning things on from nothing. If you only want teeth whitening, for instance, flip everything else off and leave tooth on.
Plus the required image input.
Outputs are image and mask - the mask covers the union of whatever features you left enabled.
Where this fits
Feed the mask into an inpaint pass for targeted facial retouching - this is the kind of thing that turns "regenerate the whole face and hope the rest doesn't drift" into "just touch the lips." It also pairs naturally with the pack's DrawBBoxMask/ObjectDetector family if you want to first isolate a specific face in a multi-person image, then run this on the cropped region for finer control.
Installing it
ComfyUI Manager: search "ComfyUI Layer Style Advance". Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/chflame163/ComfyUI_LayerStyle_Advance.git
Run install_requirements.bat (portable) or install requirements.txt yourself, then restart.
Model files are a separate download, same folder as PersonMaskUltra: grab the Mediapipe model files from the linked BaiduNetdisk mirror (or the author's combined HuggingFace download) and copy them into ComfyUI/models/mediapipe. If you've already set up PersonMaskUltra, you likely already have this covered - the two nodes share the folder.
Common issues
Empty mask / node errors immediately. Check ComfyUI/models/mediapipe actually has the model files. This is the most common reason any Mediapipe-backed node in this pack fails outright rather than just giving a poor result.
Mask misses a feature that's clearly visible. Mediapipe's face landmark detection needs a reasonably clear, forward-or-near-forward-facing view to find features reliably - a face turned sharply in profile, heavily obscured by hair, or very small in frame will degrade detection quality. This isn't a settings problem you can dial away; it's the underlying model's limitation on the input you gave it.
Multiple faces in frame, only getting one mask. The node isn't documented as multi-face aware - if you need per-person control in a group shot, crop or mask down to one face first (an ObjectDetector node feeding a crop, for instance) before running this on each region separately.
Result looks right but the edges are a bit blocky. Unlike the pack's "Ultra" family (BenUltra, Florence2Ultra, SegmentAnythingUltra), this node doesn't run a separate matting/edge-refinement pass - what Mediapipe gives you is what you get. If you need cleaner edges for a demanding composite, feed the output mask into a manual grow/blur step downstream.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| left_eye | BOOLEAN | true | — |
| left_eyebrow | BOOLEAN | true | — |
| right_eye | BOOLEAN | true | — |
| right_eyebrow | BOOLEAN | true | — |
| lips | BOOLEAN | true | — |
| tooth | BOOLEAN | true | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| mask | MASK | — |