Nodes/BrainDead Nodes/BD MP Save Face Data
ComfyUI Node

BD MP Save Face Data

Park your MediaPipe face masks so Blender can read them later

By BizaNator·Created 8 months ago·Updated 3 days ago· 15
BD MP Save Face Data
  • 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
  • head_mask
  • masked_skin
  • image
  • npz_path
  • json_path
  • status
context_id
output_dirmediapipe_data
nameface
auto_incrementtrue

The whole point of the BrainDead face pipeline is that you detect face regions once with MediaPipe, refine them with SAM3, and then do something else with them - project onto a mesh, build a UV plate, feed a Blender script. But ComfyUI masks evaporate when the graph reruns, and the original image eventually stops being MediaPipe-detectable (once you've upscaled or composited it, the landmarks are gone). BD MP Save Face Data exists to make those masks durable: it writes everything to disk as NPZ + JSON, so the face data outlives the image it came from.

What it is

A persistence node for MediaPipe face mask data. You wire the outputs of BD MP Face Mask (or the SAM3-refined versions from BD MP Face Refine) into its matching mask inputs, and it writes an .mpface.npz plus a JSON sidecar to disk. Load it back later with the pack's load node after the image is processed and MediaPipe can no longer detect anything.

How it works

The node accepts the full set of region masks the MP pipeline produces - face_oval, skin, left_eye, right_eye, eyes, brows, irises, lips, nose, ears, forehead, hair, plus head_mask (external silhouette) and masked_skin (refined skin). You wire what you have; it packs the ones that are connected into the .npz and writes a JSON sidecar with per-region bounding boxes that are readable from Blender Python - which is the whole trick for the FaceWrap workflow, where the JSON drives UV placement in a Blender subprocess.

Two output paths:

  • Legacy: output_dir (default mediapipe_data) under ComfyUI's output folder + a name base, with auto_increment appending _001, _002
  • Context-aware: wire/set context_id from a BD Save Context and the context template decides the full path, ignoring output_dir and name.

Inputs that matter

  • The mask inputs - wire from BD MP Face Mask, or from BD MP Face Refine to overwrite with SAM3-refined versions. image (the pre-resolution source image) rides along for texture generation / Blender UV projection.
  • context_id for auto-path resolution.
  • output_dir + name if you're not using a context.

Outputs: npz_path, json_path, and status. That's it - it's an output node; nothing flows onward.

Why you'd bother

The FaceWrap pipeline in the README is the canonical use: MediaPipe landmarks → SAM3-guided face masks → socket infill → UV export. The save step is what lets you iterate on the mesh side without re-running face detection every time - and it's what keeps the data available for the Blender face-plate UV pipeline, which runs outside ComfyUI's graph entirely. If your face pipeline is one-shot and throwaway, you don't need this node. If you're doing actual character work that touches a DCC, it's the difference between re-detecting every run and having the data on disk.

Installing it

ComfyUI Manager: search "BrainDead" → install. Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/BizaNator/ComfyUI-BrainDead
cd ComfyUI-BrainDead
pip install -r requirements.txt

Restart, find it under 🧠BrainDead/Segmentation. The save node itself is dependency-light (numpy + json), but the nodes that produce the masks need pip install mediapipe - not in the pack's requirements.txt, so install it if MP Face Mask isn't running. And mind the context auto-pick gotcha shared across the pack: with exactly one BD Save Context registered and an empty context_id, this node follows the context silently.

Category🧠BrainDead/Segmentation

Inputs (25)

NameTypeDefaultDescription
context_idoptSTRINGBD_SaveContext context_id. When wired/set, output_dir and name are ignored — the context template determines the full path.
face_ovaloptMASK
skinoptMASKFrom BD MP Face Mask or BD MP Face Refine (SAM3-refined).
left_eyeoptMASK
right_eyeoptMASK
eyesoptMASK
left_browoptMASK
right_browoptMASK
browsoptMASK
left_irisoptMASK
right_irisoptMASK
irisesoptMASK
lipsoptMASK
noseoptMASK
left_earoptMASK
right_earoptMASK
earsoptMASK
foreheadoptMASK
hairoptMASK
head_maskoptMASKExternal head silhouette (SAM3/BD MP Face Refine).
masked_skinoptMASKRefined skin mask (BD MP Face Refine 'skin' output or custom).
imageoptIMAGEPre-resolution image for texture generation / Blender UV projection.
output_diroptSTRINGmediapipe_dataSubdirectory under ComfyUI output/ (ignored when context_id is set).
nameoptSTRINGfaceBase filename (ignored when context_id is set).
auto_incrementoptBOOLEANtrueAppend _001, _002… to avoid overwriting.

Outputs (3)

NameTypeDescription
npz_pathSTRING
json_pathSTRING
statusSTRING