Nodes/a-person-mask-generator/A Person Face Landmark Mask Generator
ComfyUI Node

A Person Face Landmark Mask Generator

A Person Face Landmark Mask Generator — ComfyUI Node Guide

By djbielejeski·Created 3 years ago·Updated 6 months ago· 404
A Person Face Landmark Mask Generator
  • images
  • masks
facefalse
left_eyebrowfalse
right_eyebrowfalse
left_eyetrue
right_eyetrue
left_pupilfalse
right_pupilfalse
lipstrue
number_of_faces1
confidence0.40
refine_masktrue

This is the surgical sibling of A Person Mask Generator, same pack. Where that node gives you big regions - face, hair, body, clothes - this one goes down to individual facial features: eyes, eyebrows, pupils, lips. If you want to change someone's eye color without touching their eyebrows, fix one blinking eye in a batch of otherwise-good frames, or inpaint just the lips for a lipstick swap, this is the node that gets you a mask tight enough to do it without collateral damage to the rest of the face.

It's the same MediaPipe engine as its sibling, just pointed at a different task - face landmarking instead of person segmentation. Google's library locates facial landmark points (eyes, brows, lips, and so on) and the node turns whichever ones you select into a mask. It's detection and geometry, not identity - it has no idea whose face it is, only where the features sit.

The inputs: images is required, same as the sibling node. Past that, eight booleans control which features get masked: face, left_eyebrow, right_eyebrow, left_eye, right_eye, left_pupil, right_pupil, and lips. The defaults are worth knowing because they're not "everything off" like you might expect - left_eye, right_eye, and lips default to true, everything else defaults to false. So out of the box, without touching a toggle, you get eyes-and-lips masked. number_of_faces (integer, 1–10, default 1) caps how many faces in the image it'll look for - if your photo has a group of people and you leave this at 1, you're only going to get the one it finds, so bump it up for anything beyond a solo portrait. confidence (default 0.4, range 0.01–1) behaves exactly like it does on the sibling node: the detection threshold, lower it if features aren't getting picked up, raise it if it's being too aggressive. refine_mask (default true) is the same crop-and-rerun trick from the pack - it boxes the detected region and runs a second pass on just that crop, which is genuinely useful here since facial features are small to begin with and this buys back detail you'd otherwise lose, especially when the face itself is a small part of a larger image. There's one masks output, MASK type, holding whichever features you enabled.

Install is identical to the rest of the pack, because it is the rest of the pack - one repo, one set of nodes. In ComfyUI Manager, search "a-person-mask-generator." Manually, cd ComfyUI/custom_nodes && git clone https://github.com/djbielejeski/a-person-mask-generator, then pip install -r requirements.txt inside that folder, then restart. On the portable Windows build, run pip through the embedded interpreter instead of your system one - python_embeded\python.exe -m pip install -r ComfyUI\custom_nodes\a-person-mask-generator\requirements.txt - otherwise you'll get a node that fails to import even though the folder is sitting right there in custom_nodes.

A couple of practical notes rather than invented horror stories: this is a landmark detector, so it needs a reasonably clear, front-ish-on face to lock onto - extreme profile angles or heavy occlusion (hands, hair, sunglasses over the eyes) are exactly the kind of input that trips up any MediaPipe-based face task, since it's working from geometric landmarks rather than a learned identity embedding that can infer through occlusion. If a mask is coming back empty or oddly shaped, that's the first thing to check before you start second-guessing your confidence value. Wherever the mask ends up, it's an inpaint input, not an endpoint - this node hands you a tightly-scoped mask and stops there; the actual edit happens in whatever masked img2img or inpaint node you wire it into next.

CategoryA Person Mask Generator - David Bielejeski

Inputs (12)

NameTypeDefaultDescription
imagesIMAGE
faceoptBOOLEANfalse
left_eyebrowoptBOOLEANfalse
right_eyebrowoptBOOLEANfalse
left_eyeoptBOOLEANtrue
right_eyeoptBOOLEANtrue
left_pupiloptBOOLEANfalse
right_pupiloptBOOLEANfalse
lipsoptBOOLEANtrue
number_of_facesoptINT11–10
confidenceoptFLOAT0.400.01–1
refine_maskoptBOOLEANtrue

Outputs (1)

NameTypeDescription
masksMASK