Nodes/Character Face Swap/Load RetinaFace
ComfyUI Node Runs on cloud

Load RetinaFace

The detector behind every crop in this pack

By ArtBot2023·Created 3 years ago·Updated 2 years ago· 102
Load RetinaFace
    • MODEL

    Load RetinaFace is the pack's model-loader for face detection - the node you drop in once, up at the top of the graph, so every Crop Face downstream has a detector to work with. It takes no inputs at all. You wire its single RETINAFACE output into one or many Crop Face nodes and forget about it.

    RetinaFace is a well-known face detector (the original paper is from 2019) that combines a bounding-box head with facial landmark regression and dense face localization. The version this pack loads is the ResNet50 variant bundled through xinntao's facexlib library, the same detection code behind a big slice of the SD1.5-era face tooling. Its claim to fame over the older MTCNN-style detectors is that it still finds small, tilted, or partially occluded faces that simpler detectors miss - which is exactly what you want before you try to crop and swap a face.

    How it works

    When you run the node, it initializes the RetinaFace model on your default device (CUDA if available). On first load it auto-downloads the weights from xinntao's facexlib GitHub release (detection_Resnet50_Final.pth, saved into ComfyUI/models/facexlib/), so there's no separate model hunt. After that it's a fast, cached load - a chunk of weights shared by every Crop Face node in the graph, not reloaded per node.

    Wiring it

    Just one output, named MODEL:

    • MODEL (RETINAFACE)model input of Crop Face.

    There's no "batch" or "device" toggle, no precision switch, no settings at all. That's the whole node: load once, reuse everywhere.

    Installing the pack

    Same as the rest of Character Face Swap - ComfyUI Manager (search Character Face Swap) or manually:

    cd ComfyUI/custom_nodes/
    git clone https://github.com/ArtBot2023/CharacterFaceSwap.git
    cd CharacterFaceSwap
    python install.py          # on the bundled Windows build: ../../../python_embeded/python install.py
    

    That install.py step matters more here than anywhere else: it pip-installs the bundled facexlib library that RetinaFace comes from. Miss it and Load RetinaFace fails at import with No module named 'facexlib'. The weights themselves download automatically on first load, so the only real prerequisite is network access the first time you run the node.

    Common problems

    • First run hangs or errors: it's fetching the weights from GitHub Releases on first load. If it fails partway, delete the partial file in ComfyUI/models/facexlib/ and re-run - it's cached, not resumed.
    • torch.cuda.OutOfMemoryError on load: ResNet50 is heavy-ish but tiny next to a checkpoint; if you're crammed, load it once and reuse - the pack never needs more than a single instance.
    • It loads fine but Crop Face says "no face detected": that's not this node's fault, that's your confidence threshold. Lower it in Crop Face.

    If you've used face-detailer-style nodes, this is the same RetinaFace family under a different wrapper. The loader is boring on purpose - the interesting stuff is what the detector's output enables downstream.

    CategoryCFaceSwap

    Inputs (0)

    No inputs

    Outputs (1)

    NameTypeDescription
    MODELRETINAFACE