Two nodes for ComfyUI (face based filtering and batch merge).
- FaceFilter node (filter images by face similarity relative to reference images)
- MergeImageBatches (merge two image batches index by index with simple rules)
You can install it directly from the manager.
Otherwise, manually:
-
Install the node manually by going to
ComfyUI/custom_nodes/
and runninggit clone git@github.com:Kidev/ComfyUI-FaceFilter.git
-
Install Python deps:
pip install -r ComfyUI-FaceFilter/requirements.txt
-
Models (InsightFace packs)
- Default search paths (both are supported automatically)
~/.insightface/models
(home cache)<this repo>/models/insightface
(local repo models)
- Example pack folder name
antelopev2
- Default search paths (both are supported automatically)
-
Restart ComfyUI
python install.py
This only ensures the two model folders exist and prints where to drop packs.
ref_images
(IMAGE) reference images that define the target identity setcandidate_images
(IMAGE) images to test and filterthreshold
(FLOAT) cosine similarity threshold (default0.30
)on_empty_matching
(CHOICE) behavior when matching is empty (black_512
orreturn_empty
orpass_through
)on_empty_rejected
(CHOICE) behavior when rejected is empty (same choices)debug
(BOOLEAN) return a debug string with counts and scoresmodel_name
(CHOICE) an auto discovered InsightFace pack name (exampleantelopev2
)providers
(CHOICE)auto(cuda+cpu)
orcpu_only
detector_size
(INT) face detector working sizeresize_mode
(CHOICE)fit_min_side
orfit_longest_side
MATCHING
(IMAGE) batch of accepted candidates (faces matching one of the reference faces)REJECTED
(IMAGE) batch of rejected candidatesDEBUG
(STRING) multi line diagnostics when enabled
- Embeddings are L2 normalized
- Cosine similarity against the reference set
- Accept if any ref is above
threshold
- Stable fallbacks keep downstream graphs valid when a batch is empty
batch1
(IMAGE)batch2
(IMAGE)prefer
(CHOICE) pickbatch1
orbatch2
when both look valid
MERGED
(IMAGE)
- For each index pick the non black image if the other is black or empty
- If both valid pick according to
prefer
- FaceFilter (of course)
- ReActor
- Facetools
- VideoHelperSuite (only for video workflow)
Workflow avaiable here: (FaceFilter-simple.json)
A simple usage of the FaceFilter node: the images in the candidates that have pictures with the same face in the reference batch of images are passed to the matching group, the others to the rejected group.
Face matching faceswap using FaceFilter and ReActor
Workflow avaiable here:
- Picture to picture: (FaceFilter-Faceswap.json)
- Video to video: (FaceFilter-Faceswap-Video.json)
A simple faceswap tool that will swap the faces of particular persons with another. It does not uses indices or face position, only the face of the target using the FaceFilter node.
Here is a view of the most important blocks in the architecture:
Here is a simplified view for you to see the evolution of the image batches across all the nodes and understand the logic:
- Use
providers=auto(cuda+cpu)
on machines with CUDA detector_size=256
is a good balance- Keep one model pack (example
antelopev2
) available in either supported path