InsightFace Similarity
Face Identity Score, 0-10, Without Training Anything
- image1
- image2
- similarity_score
- details
"How close is this generated face to the reference?" If you've done any identity work - IP-Adapter FaceID, PuLID, InstantID, face swaps - that's the question you're always asking, usually by squinting at two images. InsightFaceSimilarity answers it with a number: feed it two images, get a similarity score and a readout of what it found.
It's the measurement half of the identity workflow. Use it to verify a PuLID or FaceID run actually held the person's face, to compare generations against a reference across seeds, or to sanity-check a face-swap pipeline. The number won't tell you "good" or "bad" - that calibration is yours - but it converts vibes into something you can compare run to run.
How it works
Under the hood it's the same InsightFace buffalo_l model pack that sits under nearly every identity tool in the space. The node detects faces, aligns them, and turns each into an ArcFace embedding - a vector that encodes facial geometry, not appearance. Then it computes cosine similarity between the embeddings of the two images and reports the best matching pair.
Two details worth knowing. First, it forces the CPUExecutionProvider rather than CUDA, deliberately, so it won't fight ComfyUI for the GPU or trip the classic "CUDA provider conflicts with Comfy's onnxruntime" mess. It's a bit slower, but it's the safe choice and for a two-image comparison it's fine. Second, the raw cosine score (roughly −1 to 1, where ~0.5-ish often means the same person) gets scaled to a friendlier 0–10 range.
Outputs are two: similarity_score (FLOAT) and details (STRING), the latter holding the actual cosine value plus face counts per image. The node also prints a small score readout in the UI.
Installing it
The node is part of Duanyll Nodepack:
cd ComfyUI/custom_nodes
git clone https://github.com/Duanyll/duanyll_nodepack
pip install -r requirements.txt # includes insightface + opencv
Or install the pack via ComfyUI Manager and let it pull dependencies. Then the real step: on first use the node auto-downloads buffalo_l (roughly 326 MB) into ComfyUI/models/insightface and initializes the model, which takes a visible chunk of time on first run. Let it finish.
Where people get burned
- The install. InsightFace has a well-earned reputation as one of the worst installs in local AI, mostly on Windows, where the C++ build has historically forced people to grab a prebuilt wheel. Modern
pip install insightfaceis far better than it used to be, but if Manager's dependency install fails, search your OS for the wheel andpip installit into ComfyUI's Python. - No faces detected. Either image returns 0.0 and a warning - check that both images actually contain a face and aren't tiny/cropped.
- Multiple faces. It picks the highest-similarity pair across all faces in both images, so a group photo can quietly report "the two most similar people in these two group shots," which may not be what you meant.
- Licensing. The library is MIT, but the
buffalo_lweights are non-commercial. Fine for personal tinkering, a real problem if you're shipping a product - worth knowing before you build a business on this node.
The score scale is also not magic: treat it as relative ("this run held identity better than that run"), not absolute. Same-person typically sits well above 0.5 cosine (~5+ after scaling) but lighting, pose, and the model's own quirks shift it.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| image1 | IMAGE | — | |
| image2 | IMAGE | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| similarity_score | FLOAT | — |
| details | STRING | — |