Nodes/comfyui_cv/CV SFace Embeddings
ComfyUI Node

CV SFace Embeddings

Turns each detected face into a 128-D identity vector (cv2.FaceRecognizerSF, the SFace model). This is the recognition half that 'CV YuNet Face Detect' does not do: YuNet answers WHERE a face is, SFace answers WHOSE it is. FaceRecognizerSF is a cv2 class the auto-generated wrappers cannot expose. Place face_recognition_sface_2021dec.onnx in ComfyUI/models/onnx. Wire YuNet's 'landmarks' output straight into 'landmarks' here - cv2 aligns each face onto a canonical 112x112 crop using ONLY those five points (eyes, nose, mouth corners), which is what makes the embedding pose-invariant. Compare the vectors with 'CV Embedding Match'. Data only: the aligned crops come out as an IMAGE batch so you can see exactly what the model read. Zero faces is a valid result (empty embeddings, count = 0).

By bmad4ever·Created 3 months ago·Updated 2 days ago· 0
CV SFace Embeddings
  • image
  • landmarks
  • embeddings
  • aligned
  • count
model
Categoryimage/CV/dnn

Inputs (3)

NameTypeDefaultDescription
imageNPARRAY,IMAGEImage the faces were detected in. An IMAGE batch uses its first frame. Accepts a ComfyUI IMAGE/MASK directly (frame 0 of a batch) or an NPARRAY. Arithmetic ops (add, multiply, etc.) process the full IMAGE batch when both inputs have the same batch size.
modelCOMBOSFace .onnx model from ComfyUI/models/onnx (face_recognition_sface_2021dec.onnx).
landmarksNPARRAY(N*5, 2) float32 landmarks, five per face in YuNet's order (right eye, left eye, nose, right/left mouth corner) - the 'landmarks' output of 'CV YuNet Face Detect'. The row count must be a multiple of 5.

Outputs (3)

NameTypeDescription
embeddingsNPARRAY(N, 128) float32, one identity vector per face, in the same order as the landmarks. Feed 'CV Embedding Match'. Empty (0, 128) when there are no faces.
alignedIMAGEIMAGE batch of the aligned 112x112 crops the model actually read - preview it when a match looks wrong; a bad alignment is the usual cause.
countINTHow many faces were embedded.