Nodes/ComfyUI-LivePortraitKJ/LivePortrait Load FaceAlignmentCropper
ComfyUI Node Runs on cloud

LivePortrait Load FaceAlignmentCropper

For the small faces MediaPipe misses

By kijai·Created 2 years ago·Updated 2 years ago· 2,199
LivePortrait Load FaceAlignmentCropper
    • cropper
    face_detectorblazeface_back_camera
    landmarkrunner_devicetorch_gpu
    face_detector_devicecuda
    face_detector_dtypefp16
    keep_model_loadedtrue

    The newest detector in the pack, added in a later update to fix the exact gap the other two leave open: small faces. LivePortraitLoadFaceAlignmentCropper loads a detector built on the face-alignment library (1adrianb's), which can use two blazeface variants and the SFD detector - and crucially, blazeface's back-camera model detects faces much farther away than the short-range blazeface that MediaPipe is stuck with. If you've ever run a wide shot through LivePortrait and gotten a row of black frames where the face should be, this is the node that fixes it.

    The detector choice

    • blazeface_back_camera (default) - the model tuned for selfie-camera and rear-camera distances, i.e. it finds small faces at distance. This is the whole reason to use this node.
    • blazeface - the short-range front-camera model; about on par with what MediaPipe offers.
    • sfd - the older Single Shot Face Detector. Different failure profile, sometimes better in odd lighting.

    Two things worth knowing before you switch:

    1. The first warmup is slow. The README warns the initial run can take a long time while it loads. Subsequent runs are quick. Don't assume it's hung - let it finish once.
    2. The license story stays clean. This detector path doesn't pull in InsightFace's non-commercial weights, so you keep the permissive stack.

    The device controls

    Three device/dtype inputs to get right:

    • landmarkrunner_device - where the landmark model runs; includes torch_gpu like the MediaPipe node (the PyTorch-converted landmark runner, no ONNX needed).
    • face_detector_device (cuda / cpu / mps) - where the detector itself runs. Default cuda; on Apple silicon pick mps.
    • face_detector_dtype (fp16 / bf16 / fp32, default fp16) - precision for the detector. fp16 is fast and fine; drop to fp32 if you see detection weirdness.

    Plus keep_model_loaded (default on). Output is a cropper (LPCROPPER) into LivePortrait Cropper - same hand-off as the other two loaders, so swapping detectors in an existing workflow is a one-node change.

    Where it fits

    The decision tree for the three loaders: InsightFace when you need extreme-angle robustness and don't care about the license, MediaPipe as the clean default, and this one when MediaPipe can't find the face - small faces, wide shots, faces far from the driver. It's the least-tested of the three, so expect to fiddle with face_detector_dtype or switch to sfd if your source confuses it. And remember that warmup cost is one-time; after that it behaves like a normal detector.

    CategoryLivePortrait

    Inputs (5)

    NameTypeDefaultDescription
    face_detectorCOMBOblazeface_back_camera3 options: blazeface, blazeface_back_camera, sfd
    landmarkrunner_deviceCOMBOtorch_gpu5 options: CPU, CUDA, ROCM, CoreML, torch_gpu
    face_detector_deviceCOMBOcuda3 options: cuda, cpu, mps
    face_detector_dtypeCOMBOfp163 options: fp16, bf16, fp32
    keep_model_loadedBOOLEANtrue

    Outputs (1)

    NameTypeDescription
    cropperLPCROPPER