Nodes/BrainDead Nodes/BD MP Face Mask
ComfyUI Node

BD MP Face Mask

Landmark-precise face masks in ~5ms with zero prompts — MediaPipe's free win

By BizaNator·Created 8 months ago·Updated 3 days ago· 15
BD MP Face Mask
  • image
  • head_mask
  • face_oval
  • skin
  • left_eye
  • right_eye
  • eyes
  • left_brow
  • right_brow
  • brows
  • left_iris
  • right_iris
  • irises
  • lips
  • nose
  • left_ear
  • right_ear
  • ears
  • forehead
  • hair
  • status
  • bbox_json
detection_confidence0.50
face_expand0
feature_expand4
subtract_nosefalse
iris_expand4
ear_expand25
hair_expand20
bbox_featurenone
bbox_frame0

BD MP Face Mask extracts per-region face masks from a single image using MediaPipe Face Landmarker landmarks - eyes, brows, lips, nose, ears, forehead, hair, the whole face, as separate masks. The headline numbers are the whole pitch: deterministic, CPU-only, roughly 5 ms per frame, no SAM3 prompts needed. If you need face region masks and you're currently typing "left eyebrow, right eyebrow" into a segmentation model, this node is dramatically cheaper - and it's a natural first stage for the pack's face pipeline.

The masks are drawn from the 468/478 landmark points rather than painted with a big blurry oval: eyebrows are enveloped from their contour, eyes use eroded eyelid regions, lips follow the organic mouth contour. That's the "shared tight drawing" the pack brags about, and it's what makes these masks usable for things like skin repainting where precision matters.

The outputs (there are a lot)

The node produces the full family: face_oval (jaw to hairline, no neck), skin (the oval minus eyes/brows/lips - your primary painting region), individual and combined left_eye/right_eye/eyes, left_brow/right_brow/brows, left_iris/right_iris/irises, lips, nose, left_ear/right_ear/ears, forehead, and hair. Note the left/right convention: "left eye" is the subject's left, which appears on the right side of a front-facing image. Plus status and bbox_json.

The inputs that matter

  • head_mask - the one you'll reach for most. MediaPipe's face oval can miss bald heads, full chin edges, and unusual head shapes. Wire an external head silhouette (e.g. from SAM3) and it becomes the skin base instead of the oval; MediaPipe still runs for landmarks, it just stops deciding where the head ends.
  • feature_expand - grows eye/brow/lip regions before they're subtracted from skin. Default 4; 3–6 px covers lashes and lip borders. Too low and skin bleeds into features; too high and you carve skin away.
  • face_expand - expands the oval itself. +4 catches jaw-edge hair strands. Negative contracts.
  • subtract_nose - exclude the nose region from skin too, if that's what your pipeline needs.
  • iris_expand - fills out the 4-point iris ring into the coloured disc (3–6 px reads as a natural circle).
  • bbox_feature + bbox_frame - emits the bounding box of a chosen feature as bbox_json, for feeding box-prompted SAM3 (e.g. SAM3_Detect).

The honest limits

These are geometric masks, not semantic ones. They know where an eyebrow is; they don't know whether the pixel at that location is actually eyebrow-colored. That's why the pack layers BD MP SAM3 Face Segment on top when it needs pixel-accurate results - and if you have a stylized brow that's offset from where MediaPipe's landmarks sit, the pure landmark version will be off. For the fast, deterministic, no-GPU baseline, though, this is the node. MediaPipe is also the license-clean play here (Apache 2.0), so it's the one that survives shipping.

Installing

Same as the pack - ComfyUI Manager search "BrainDead", or clone + pip install -r requirements.txt + restart. Requires the mediapipe package; the face_landmarker.task model auto-downloads on first run. All V3 API, so keep ComfyUI current.

Reach for this as the free first pass, then decide how much precision your actual output needs before pulling in SAM3.

Category🧠BrainDead/Segmentation

Inputs (11)

NameTypeDefaultDescription
imageIMAGEInput image or batch. Each frame processed independently.
head_maskoptMASKOptional external head silhouette (e.g. from SAM3). When wired, this mask is used as the base for computing 'skin' instead of MediaPipe's face_oval. MediaPipe still runs for landmark detection (eyes/brows/lips/etc.) — it just doesn't determine the head boundary. Use this when MediaPipe's oval misses bald heads, full chin edges, or unusual head shapes.
detection_confidenceoptFLOAT0.500.1–1Face detection confidence threshold.
face_expandoptINT0-30–80Pixels to expand (+) or contract (-) the face oval boundary. +4 helps catch jaw-edge hair strands.
feature_expandoptINT40–40Pixels to expand eye/brow/lip regions before subtracting from skin. Covers lashes and lip border. 3–6 px is typical.
subtract_noseoptBOOLEANfalseWhen True, nose region is also excluded from skin mask.
iris_expandoptINT40–20Pixels to expand iris landmark ring outward to fill the coloured disc. Iris ring is 4 points; 3-6 px gives a natural circle. 0 = tight hull only.
ear_expandoptINT250–80Pixels to expand ear (preauricular) region beyond the face oval edge.
hair_expandoptINT200–80Pixels to expand hair region downward into the hairline transition zone.
bbox_featureoptCOMBOnoneWhich feature to emit as a bounding box. 'none' skips bbox computation. bbox is from frame 0 (or first detected frame). Wire bbox to SAM3_Detect bboxes for box-prompted segmentation.
bbox_frameoptINT00–63Which frame index to extract the bbox from (default 0).

Outputs (20)

NameTypeDescription
face_ovalMASKComplete face silhouette (jaw to hairline). No neck, no background.
skinMASKhead_mask (if wired) or face_oval, minus eyes + brows + lips (and nose if subtract_nose). Primary skin-painting region.
left_eyeMASKLeft eye (subject's left = image right for front-facing).
right_eyeMASKRight eye (subject's right = image left for front-facing).
eyesMASKBoth eyes combined.
left_browMASKLeft eyebrow.
right_browMASKRight eyebrow.
browsMASKBoth brows combined.
left_irisMASKLeft iris disc (coloured part of eye). Requires 478-point model.
right_irisMASKRight iris disc.
irisesMASKBoth irises combined.
lipsMASKFull lip area (upper + lower, inner + outer contour).
noseMASKNose — tip, bridge, and nostril rims.
left_earMASKLeft preauricular region (near lm 234), expanded by ear_expand.
right_earMASKRight preauricular region (near lm 454).
earsMASKBoth ears combined.
foreheadMASKUpper ~40% of face_oval minus brow band.
hairMASKRegion above face oval, to image top edge.
statusSTRING
bbox_jsonSTRINGTight bbox of bbox_feature from bbox_frame as JSON string {"x","y","width","height"}. "{}"when bbox_feature='none' or face not detected. Note: BOUNDING_BOX typed output is omitted — V3 dispatcher routes the dict to the wrong downstream parameter. Use bbox_json + a JSON parse node if you need a bbox socket.