ComfyUI Node

RetinaFace PM

The face finder every other node in this pack leans on

By THtianhao·Created 3 years ago·Updated 2 years ago· 201
RetinaFace PM
  • image
  • crop_image
  • crop_mask
  • crop_box
multi_user_facecrop_ratio1.00
face_index0

If you run any real workflow built on this pack, it almost certainly starts here. RetinaFace PM is the "find the face" step - it detects faces in an image, crops out the head, and hands you a mask and a box to work with. It's the entry ramp for FaceFusion, the box source for SuperColorTransfer, and the thing that makes "do something to just this person" possible at all.

RetinaFace is the face-detection algorithm from the InsightFace family - the same detection lineage that sits under ReActor, Roop, and most of the identity stack (the KB has a full panel on that dependency). This node runs it through a ModelScope pipeline, damo/cv_resnet50_face-detection_retinaface, which gets pulled down to your ModelScope cache on first use. Detection is one thing and recognition is another: this node finds faces and crops them, it does not tell you who they are. If you want identity, that's FaceFusion or Similarity's job.

Three inputs, and only two you'll ever touch:

  • image - the photo. Feed it one image at a time; the node squeezes the batch dimension, so a batched tensor will confuse it.
  • multi_user_facecrop_ratio (default 1, 0–10) - how much of the head region to grab, as a multiplier. Leave it at 1 for a tight head crop; push it up to pull in the neck, shoulders, and background around the face.
  • face_index (default 0) - which face to use when there are several people in frame. Added in v1.1; it just indexes into the detected list, so pick 0 for the first face detected.

It returns three things and all of them get used elsewhere: crop_image (the head crop itself), crop_mask (a rough matting mask of the person), and crop_box (the bounding box). In the stock EasyPhoto workflow, crop_image feeds the fusion/identity steps, crop_mask flows into mask ops like ExpandMaskBox or SetLatentNoiseMask, and crop_box plugs straight into the avatar_box input of SuperColorTransfer - same image, same pixel space, so the boxes line up.

Install is the pack install: ComfyUI Manager (search "Portrait-Maker") or git clone https://github.com/THtianhao/ComfyUI-Portrait-Maker into custom_nodes, then restart. Two things bite people on first run. The pack downloads a big stack of models at startup - several GB of ControlNet pth files, a LoRA, a VAE, plus pack-local weights - and the README warns not to interrupt it, because there's no hash verification and a partial file just sits there. The RetinaFace model itself downloads separately, lazily, the first time you run the node, so expect a long stall the first time and near-instant loads after.

The failure modes are the obvious ones. No face in frame, or a face_index past the number of faces, and you'll get an index error. A very small or very rotated face detection can also produce a crop that's mostly background - that's what the crop ratio knob is for. And it's worth knowing the whole pack is a 2024-era port of Alibaba's EasyPhoto, untouched since v1.2.0, so it leans on older SD 1.5 infrastructure. It still works fine; just don't expect active development or a fix for the dependencies if something breaks in a newer Python.

Categoryprotrait/model

Inputs (3)

NameTypeDefaultDescription
imageIMAGE
multi_user_facecrop_ratioFLOAT1.000–10
face_indexINT00–10

Outputs (3)

NameTypeDescription
crop_imageIMAGE
crop_maskMASK
crop_boxBOX