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

BD MP Load Face Data

Reload MediaPipe face masks after the image is gone

By BizaNator·Created 8 months ago·Updated 3 days ago· 15
BD MP Load 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
    • status
    file_path
    context_id
    frame_index0

    Here's the problem BD_LoadMPFaceData exists to solve: MediaPipe face detection runs on a source image, but by the time you want the face masks, the image has been processed into something MediaPipe can no longer recognize - re-posed, re-rendered, or replaced entirely. The pack's answer is to persist everything MediaPipe found as a .mpface.npz file at save time (BD MP Save Face Data), then reload it later with this node. No MediaPipe needed at load time - that's the whole trick.

    It outputs the full set of region masks the face-detection pass produces: face_oval, skin, left_eye/right_eye/eyes, left_brow/right_brow/brows, left/right/combined irises, lips, nose, left_ear/right_ear/ears, forehead, hair - plus head_mask, a masked_skin, and the original image. That's 22 outputs of ready-made masks.

    How to point it at a file

    • file_path - the direct way. Give it the .mpface.npz (or .mpface.json) path and it loads that file.
    • context_id - the pack-aware way. Leave file_path empty and give a BD_SaveContext context id (or just have a single registered context and let it auto-pick), and the node resolves the path from the context template automatically - i.e. it finds the most recently saved .mpface.npz for that context. This is the round-trip flow: Save Face Data writes with a context, Load Face Data finds it again without you typing a path.
    • frame_index (0–63) - which saved frame to load. Always 0 for single-frame saves; relevant if your pipeline saved a multi-frame sequence.

    Missing regions come back as blank masks rather than errors - consistent with the rest of the pack's fail-soft loaders.

    Where it fits

    In the FaceWrap pipeline, you typically: detect face data on the original image → save it → run the heavy processing (SAM3-guided refinement, Qwen edits, whatever) → load the face data back at export time so the region masks still line up with the processed image for compositing or UV work. It's the persistence layer that makes that possible. The README's framing is exactly right: "reload later (after the image is processed and MediaPipe can no longer detect)."

    Install

    Part of the BrainDead pack:

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

    Or search "BrainDead" in ComfyUI Manager and restart. Notably, this node needs no MediaPipe runtime - it's pure file loading.

    Troubleshooting

    • "File not found" with context_id - no save exists yet for that context; run the save node once first, or type the path directly.
    • Masks come back blank - the file didn't have that region (e.g. no ears detected in the original pass), or you loaded the wrong frame index.
    • Sizes don't match your processed image - the saved masks are at the original resolution; resize or re-align them to the current image before compositing.
    Category🧠BrainDead/Segmentation

    Inputs (3)

    NameTypeDefaultDescription
    file_pathSTRINGPath to .mpface.npz (or .mpface.json). Leave empty to auto-locate via context_id.
    context_idoptSTRINGBD_SaveContext context_id. When file_path is empty, resolves the path automatically from the context template. Also accepts auto-pick when only one context is registered.
    frame_indexoptINT00–63Which saved frame to load (always 0 for single-frame saves).

    Outputs (22)

    NameTypeDescription
    face_ovalMASK
    skinMASK
    left_eyeMASK
    right_eyeMASK
    eyesMASK
    left_browMASK
    right_browMASK
    browsMASK
    left_irisMASK
    right_irisMASK
    irisesMASK
    lipsMASK
    noseMASK
    left_earMASK
    right_earMASK
    earsMASK
    foreheadMASK
    hairMASK
    head_maskMASK
    masked_skinMASK
    imageIMAGE
    statusSTRING