Nodes/comfyui-fvmtools/Person Selector (Match)
ComfyUI Node

Person Selector (Match)

'Is that them?' — a one-shot ArcFace matcher

By ping1979ping·Created 5 months ago·Updated 30 days ago· 0
Person Selector (Match)
  • current_image
  • reference_images
  • sam_model
  • similarity
  • match
  • mask
  • best_reference
  • face_count
  • matched_face_index
  • report
threshold0.65
aggregation
mask_mode
mask_fill_holestrue
mask_blur0
det_size

The simplest question in face-consistency work is "is that them?", and Person Selector answers it with a number. It takes your current image, compares every detected face against one or more reference images using InsightFace ArcFace embeddings, and hands you the best similarity score, a boolean match, and an optional mask. It's the single-reference little sibling of Person Selector Multi - same ArcFace backbone, none of the multi-person machinery.

Where you'd actually use it: as a gate. Wire match into a switch so a detailer or a save node only runs when your character is actually in frame, or log the similarity to decide whether a generation is worth keeping. If you're holding one consistent character across a batch of renders, this is often all you need - Multi is for when you've got two or more people competing for attention.

How it works

InsightFace detects and aligns faces, then produces ArcFace embedding vectors - biometric identity, not appearance. The node compares the current image's faces against the reference embeddings. aggregation decides how to combine scores when you feed multiple reference images of the same person: max, mean, or min. threshold is the cosine-similarity cutoff, and 0.6–0.7 is the recommended band - too low and every face "matches", too high and your character stops matching their own slightly-off renders.

mask_mode picks the segmentation: face and head masks come from BiSeNet parsing (the pack's 53MB parsing_bisenet.pth), while body needs a SAM model connected to the optional sam_model input - from Impact Pack's SAMLoader. Set none if you only want the score, and the node skips segmentation entirely.

The inputs that matter

  • current_image and reference_images - the two images.
  • threshold - the match cutoff (0.6–0.7).
  • mask_mode - none / face / head / body.
  • det_size - higher finds smaller faces but uses more VRAM.

Outputs

similarity, match, mask, best_reference (the reference that matched best), face_count, matched_face_index, and a report string. The first two are what you wire into logic.

Install

Face tools pull in the pack's real dependencies:

cd ComfyUI/custom_nodes
git clone https://github.com/ping1979ping/comfyui-FVMtools
pip install insightface>=0.7.3 onnxruntime-gpu>=1.17.0 opencv-python>=4.8.0 numpy>=1.24.0

Restart. InsightFace's buffalo_l models auto-download on first use (~342MB into models/insightface/models/buffalo_l); parsing_bisenet.pth is a manual ~53MB download into models/gfpgan/.

Common issues

Install errors are the #1 wall - onnxruntime-gpu wants a CUDA-matching version, and CPU-only users should install plain onnxruntime instead. If the node errors on model download, grab the buffalo_l files from HuggingFace and drop them in manually. Body masks silently missing = SAM isn't connected. And remember InsightFace's pretrained ONNX models carry non-commercial license restrictions - fine for hobby use, a real consideration if anything here touches commercial work.

CategoryFVM Tools/Face

Inputs (9)

NameTypeDefaultDescription
current_imageIMAGE
reference_imagesIMAGE
thresholdFLOAT0.650–1Minimum cosine similarity to count as match (0.6-0.7 recommended)
aggregationCOMBOHow to combine similarity scores across multiple reference images
mask_modeCOMBOnone=no mask, face=skin only, head=face+hair, body=full body (needs SAM)
mask_fill_holesBOOLEANtrueFill holes inside the mask (closes gaps in segmentation)
mask_blurINT00–100Gaussian blur radius for mask edges
det_sizeCOMBOFace detection resolution — higher finds smaller faces but uses more VRAM
sam_modeloptSAM_MODEL(opt) SAM model from Impact Pack SAMLoader — required for body mask mode

Outputs (7)

NameTypeDescription
similarityFLOAT
matchBOOLEAN
maskMASK
best_referenceIMAGE
face_countINT
matched_face_indexINT
reportSTRING