Nodes/ComfyUI_FaceShaper/ faceShaper LoadModel DLib(legacy)
ComfyUI Node

faceShaper LoadModel DLib(legacy)

The legacy dlib loader behind FaceShaper's original node

By fssorc·Created 2 years ago·Updated 2 years ago· 188
faceShaper LoadModel DLib(legacy)
    • FaceShaper_MODELS
    DetectType

    The display name spells out exactly what this is: "faceShaper LoadModel DLib(legacy)". It's a one-job loader - pick which dlib face landmark predictor to use, and this node hands the loaded model to the original FaceShaper node's analysis_models input. If you're setting up FaceShaper fresh today, you probably don't want this node at all; the V2 pipeline (FaceShaperCropperFaceShaperMatchV2FaceShaperComposite) does the same job without touching dlib. This node exists for people who already have dlib working and want the simpler one-node legacy flow.

    What it does

    dlib ships several pretrained face landmark predictors that differ in how many points they map onto a face. This node loads one of them and passes it downstream - nothing more. All the actual shape-matching logic lives in the FaceShaper node it feeds.

    The input that matters

    There's exactly one setting: DetectType, an enum choosing between 81, 68, or 5 landmark points. More points give a more detailed map of the face (useful for finer-grained shape matching); 5 is the sparsest and fastest option, mainly used in classic dlib pipelines for basic alignment rather than detailed shape work. 68 is the traditional dlib default that most tutorials and pretrained predictors assume. Whichever you pick, you need the matching .dat file downloaded and in place (below) - the node has nothing to load without it.

    The single output is FaceShaper_MODELS, wired directly into the legacy FaceShaper node's analysis_models input. Nothing else in the pack consumes it - this is exclusively the legacy node's dependency.

    Installing it

    Through ComfyUI Manager, search "ComfyUI_FaceShaper," or manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/fssorc/ComfyUI_FaceShaper
    

    then restart. This node is where the pack's heaviest, most failure-prone dependency lives: dlib.

    1. Install dlib: pip install dlib. This has a long history of failing to build from source, particularly on Windows, because it normally needs a working C++ compile environment. The pack's README links a precompiled Windows wheel as the recommended workaround if a plain pip install doesn't work for you.
    2. Download the predictor files matching whichever DetectType you plan to use, from huggingface.co/matt3ounstable/dlib_predictor_recognition: shape_predictor_68_face_landmarks.dat, shape_predictor_81_face_landmarks.dat, shape_predictor_5_face_landmarks.dat, plus dlib_face_recognition_resnet_model_v1.dat. Put all of them in ComfyUI/models/dlib/.

    Common issues & troubleshooting

    dlib fails to compile from source. This is the expected failure mode on a plain pip install dlib, especially on Windows without Visual Studio build tools already set up. Skip straight to the precompiled wheel the README links rather than fighting a from-source build.

    dlib appears to install successfully, but the node still throws name 'dlib' is not defined at runtime. This is a real failure people have hit even after getting dlib installed via the wheel route, with no clean fix reported - it's the kind of environment-specific breakage that's genuinely not worth chasing down. If you land here, the pragmatic move is to abandon the legacy dlib path entirely and switch to FaceShaper's V2 pipeline, which uses InsightFace, MediaPipe, or face-alignment instead and never imports dlib at all.

    Wrong or missing .dat file for the DetectType you selected. The node needs the specific predictor file matching your chosen point count sitting in ComfyUI/models/dlib/ - download all three if you're not sure which you'll end up wanting, since they're small.

    Given how often dlib installs go sideways, this node is really only worth using if it's already working in your environment for something else. If you're starting from zero, the V2 pipeline gets you the same result with a much shorter list of ways to fail.

    CategoryFaceShaper

    Inputs (1)

    NameTypeDefaultDescription
    DetectTypeCOMBO3 options: 81, 68, 5

    Outputs (1)

    NameTypeDescription
    FaceShaper_MODELSFaceShaper_MODELS