Face Reference Embedding
The 'who are we looking for' node
- reference_images
- reference_embedding
Before the Face Extractor can hunt through a video, it needs to know what it's hunting for. That's this node's entire job: it takes one or more reference face images and turns them into a FACE_EMBEDDING - the vector that the extractor compares every detected face against. Load a photo of the person you want, run this, and wire the result into the extractor's reference_embedding input. That's the whole pipeline.
It matters more than it looks, because the quality of your reference embedding decides everything downstream. Feed it one good, well-lit, front-facing crop and the extractor will find that person reliably. Feed it a grainy, side-angle thumbnail and you'll be chasing false matches or missing shots for the rest of the afternoon.
How it works
Mechanically it's simple: every image you pass in gets run through the chosen detection backend, every detected face above min_confidence (default 0.5) is embedded, and the node averages all those embeddings and normalizes the result to unit length. That average is what makes multiple references genuinely useful - three decent shots of the same person produce a more robust target than any single one. The output is a dict that carries the embedding plus metadata (how many faces went into it, which backend, the license) - handy when the extractor's console output tells you what it's matching against.
One trap worth naming: it averages every face above the confidence bar in your reference images. Feed it a group photo and you'll average two different people's embeddings into a mush that matches neither. Keep references as single-person crops. And if nothing clears min_confidence, the node just raises an error - "No faces detected in reference images" - so if that fires, you've got a blurry or non-face input rather than a bug.
Inputs and output
- reference_images (IMAGE, required) - from a LoadImage node. Can be a batch of multiple shots.
- detection_backend (enum, default facenet) - same five-option menu as the rest of the pack, and only installed backends show up. FaceNet is the MIT-licensed commercial-safe pick.
- min_confidence (FLOAT, 0.5 default) - how sure the detector must be before a face counts. Raise it if a busy background keeps dragging in false faces.
The single output, reference_embedding, is a custom FACE_EMBEDDING type that only the pack's own FaceExtractor node accepts - so don't expect to plug it into IP-Adapter or InstantID. Different tools, different embeddings. This one is strictly the front end of the extraction pipeline.
Install
Part of llikethat/ComfyUI-faceExtractor, so install the pack once and you get all three nodes (this, Face Extractor, and Face Matcher). ComfyUI Manager: search "faceExtractor". Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/llikethat/ComfyUI-faceExtractor
cd ComfyUI-faceExtractor
pip install facenet-pytorch mediapipe psutil
Restart and it shows up under the "Face Extractor" category. If you want the InsightFace backend instead, that's an extra pip install insightface onnxruntime-gpu - and a reminder that InsightFace's models are non-commercial, so FaceNet is the safe default if this is for anything you might sell.
Practical notes
- Keep the backend consistent across the reference node and the extractor. Thresholds shift between neural and histogram-based backends (the Face Matcher article has the full table), and mixing them makes matching unpredictable.
- Two clean shots beat one perfect one - but three wildly different angles (one front, one profile, one under a hat) can drag the average off. Pick consistent, similar-quality frames of the same look.
- The pack ships a
02_multi_reference.jsonworkflow showing the multi-image setup, and04_deaging_pipeline.jsonif you're extracting both a source and a destination face for a two-person job.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| reference_images | IMAGE | — | |
| detection_backendopt | COMBO | facenet | 5 options: facenet, yolov8, insightface, mediapipe, opencv_cascade |
| min_confidenceopt | FLOAT | 0.500.1–1 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| reference_embedding | FACE_EMBEDDING | — |