Nodes/comfyui_face_parsing_New/FaceParsingModelLoaderNew
ComfyUI Node

FaceParsingModelLoaderNew

The boring node that gives your faces 19 switchable masks

By isurulkh·Created 7 months ago·Updated 7 months ago· 0
FaceParsingModelLoaderNew
    • FACE_PARSING_MODEL
    devicecpu

    FaceParsingModelLoaderNew is the least interesting node in this pack, and you should still care about it, because it's the key that unlocks the whole thing. It doesn't mask anything, colorize anything, or make a pixel prettier. It just loads a model - a SegFormer fine-tuned on CelebAMask-HQ that labels every pixel of a face as one of 19 regions: skin, nose, eyes, eyebrows, upper and lower lip, hair, ears, neck, clothing, even hat and glasses. Get that loaded and the rest of the pack can hand you a clean mask for any combination of those regions. That's a genuinely handy superpower in ComfyUI.

    What it's actually for

    The name tells you the genre: face parsing is semantic segmentation of a face, not detection. A YOLO detector tells you where a face is (a box). A parsing model tells you which pixel is lip and which is skin. That difference is the whole reason to reach for this instead of the usual Impact-Pack-plus-detector route - you get per-region masks a bounding box can never give you.

    Concretely: that Flux portrait with the waxy, plastic skin? The classic fix is a skin-only mask feeding an inpaint/denoise pass that smooths skin while eyes, lips and hair stay untouched. Change hair color, shift a lipstick shade, kill a background - every one of those wants a precise mask, and this pack makes them without you painting a single blob. This loader is step one of the four-node chain: FaceParsingModelLoaderNew → FaceParsingProcessorLoader → FaceParse → FaceParsingResultsParser, which finally emits the MASK you wire into your inpainting or detailing nodes.

    What it actually does

    Under the hood it's a thin wrapper around HuggingFace transformers:

    model = AutoModelForSemanticSegmentation.from_pretrained(face_parsing_path)
    if device == "cuda" and torch.cuda.is_available():
        model.cuda()
    

    That's the whole node. It reads ComfyUI/models/face_parsing/, where the pack auto-downloads model.safetensors (~160MB) plus its config files on first launch, then moves the model to GPU if you asked for it and one exists. Because ComfyUI caches node outputs by their inputs, it loads once per device value and reuses it - not on every run.

    The one input that matters

    There's exactly one, device, a dropdown with cpu or cuda, defaulting to cpu. If you have a GPU, set it to cuda - otherwise your parsing runs on CPU and the whole workflow feels sluggish. One quirk worth knowing: pick cuda on a machine without a GPU and it doesn't error, it just silently stays on CPU. The code checks torch.cuda.is_available() rather than trusting your dropdown. The single output is FACE_PARSING_MODEL, and it wires into the model input of FaceParse. That's it. Nothing to tune, nothing to break.

    Installing it

    Easiest path is ComfyUI Manager: search "comfyui_face_parsing_New" (or "face parsing") and hit install. Or do it by hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/isurulkh/comfyui_face_parsing_New
    

    Then restart ComfyUI. First load downloads the ~160MB SegFormer into models/face_parsing/ and also pulls a face_yolov8m.pt into models/ultralytics/bbox/ - more on that below - and pip-installs whatever's missing from its requirements.

    Gotchas and trouble

    • transformers isn't in the requirements file. The shipped requirements.txt lists opencv-contrib-python-headless, torchvision, ultralytics, and matplotlib - but the code does from transformers import .... ComfyUI's own environment usually bundles transformers, so you're probably fine; on a stripped install the node dies with an ImportError. The fix is a one-liner: pip install transformers.
    • The YOLO face detector downloads but nothing uses it. The pack grabs face_yolov8m.pt from Bingsu's ADetailer repo on startup, yet no shipped node calls it - a leftover from the original pack's design. Harmless, just a few tens of MB of disk you didn't ask for.
    • It's a fork, and the renames tell the story. This is a "New" rebuild of Ryuukeisyou's comfyui_face_parsing, a pack that became notorious for dying with IMPORT FAILED after ComfyUI updates - Manager's "Try Fix" often didn't help, and whole skin-enhancement workflows crashed at the node. This fork renames every class with a New/(FaceParsing) suffix, the standard move for dodging node-name collisions with the old pack. If a workflow you downloaded still references the original node names, you need the original pack installed alongside, not this one.
    • The startup pip-install and model download mean the first launch is slow, and it's running whatever the pack's __init__.py tells it to - normal for this ecosystem, and the same reason you should only install packs you trust.

    If all you need is "find the face and re-render it," the Impact Pack's FaceDetailer is a faster, more battle-tested route. Reach for face parsing when you need parts of the face - just the skin, just the lips - and you'd rather not hand-mask them.

    Categoryface_parsing

    Inputs (1)

    NameTypeDefaultDescription
    deviceCOMBOcpu2 options: cpu, cuda

    Outputs (1)

    NameTypeDescription
    FACE_PARSING_MODELFACE_PARSING_MODEL