ComfyUI Node

Face Detection

Find the faces before you try to fix them

By Haoming02·Created 2 years ago·Updated about a year ago· 66
Face Detection
  • image
  • FACES
hrfalse

Face Detection is the node that decides which parts of your photo are faces before anything tries to improve them. It's the necessary middle step in ComfyUI Old Photo Restoration's face pipeline: on its own it doesn't restore anything, it just locates faces and hands them off - you always pair it with Face Enhancement (Stage3) and Face Align (Stage4) downstream. If you just want a general cleanup pass with no face-specific work, you don't need this node at all; use Global Restoration (Stage1 or Stage1S) by itself instead.

This is also, going by search demand, the node people actually look up by name most in this pack - makes sense, since "detect the face" is the step people get curious about when "old photo restoration ComfyUI" brings them here.

How it works

The pack's face pipeline traces back to the original Bringing-Old-Photos-Back-to-Life paper's approach: locate faces with classical landmark detection, then run a face-specific enhancement network only on those crops (global restoration alone tends to soften faces, since it's optimizing for the whole frame at once). The model file the README has you download for this stage - shape_predictor_68_face_landmarks.dat - is the standard dlib 68-point facial landmark predictor, a well-known, CPU-friendly model that's been the go-to for this exact job since long before diffusion models existed. It's a different lineage entirely from something like ControlNet's OpenPose preprocessor, which detects 70 face landmark points as part of a much bigger pose/hand/face keypoint model built for steering diffusion generation - dlib's version is older, narrower, and lighter, which is exactly what you want for a fast detection pass that just needs to find face regions, not drive a generation.

Inputs and outputs

Two inputs:

  • image (IMAGE) - the photo to scan for faces. In practice this is usually the output of Global Restoration, since you'll want faces detected on the cleaned-up version, not the raw scan.
  • hr (BOOLEAN, default false) - the pack's "higher parameters" toggle, applied here too.

Output is FACES - a pack-specific type, not a standard ComfyUI IMAGE. It's a bundle of the detected face regions and their landmark data, and the only thing downstream that understands it is Face Enhancement (Stage3). You can't preview it or save it directly; it only makes sense wired straight into Stage3.

Installing it

Via ComfyUI Manager, search "ComfyUI Old Photo Restoration" and install. Or manually:

cd ComfyUI/custom_nodes
git clone https://github.com/Haoming02/comfyui-old-photo-restoration

restart, then confirm the lib_bopb2l folder is present (pull backend.zip from Releases if not).

This node specifically needs the landmark model: download shape_predictor_68_face_landmarks.zip from the Releases page of Haoming02/sd-webui-old-photo-restoration (the author's earlier A1111 extension - same checkpoints, different repo) and extract just the .dat file into lib_bopb2l/Face_Detection/. Unlike the Global and Face Enhancement checkpoints, this one's a single file, not a folder - don't nest it inside an extra directory.

Common issues

dlib fails to import at all. dlib is a compiled C++ library under the hood, and getting a working Python wheel for it is a recurring headache for people running related old-photo ports on Windows - the fix that's worked for others is installing a prebuilt wheel matched to your exact Python version (check what ComfyUI's embedded Python reports, then grab a matching dlib-*.whl rather than letting pip install dlib try to compile it from source).

No faces detected on a clearly-has-faces photo. Landmark detectors like this one are sensitive to resolution and contrast - very small, very dark, or heavily degraded faces can slip past it. Running Global Restoration first, before Face Detection, usually helps, since it improves the contrast the detector has to work with.

FACES output won't connect to anything except Stage3. That's correct behavior, not a bug - it's a custom type by design, not an image.

Categoryold-photo

Inputs (2)

NameTypeDefaultDescription
imageIMAGE
hrBOOLEANfalse

Outputs (1)

NameTypeDescription
FACESFACES