RekogniFlow π Face Compare (batch)
Fire a whole batch at a face, keep the one that actually looks like them
- image_source
- image_batch
- best_image
- best_score
- attempts_used
- threshold_met
- detail_json
The batch version of RekogniFlow's face compare is where the pack actually earns its keep. You've got a reference face, you've generated a batch of candidates from a KSampler, and you want the winner picked for you - no squinting at a grid, no manual "which one is closest" decisions. Wire your batch in, set a target, and the node returns the best image, its score, and how many renders it had to check to find it.
If you've built identity-preservation workflows before (IP-Adapter FaceID, InstantID, Reactor - the whole "keep this face consistent" family from the ecosystem), you know the ritual: generate, stare, reject, regenerate. This node replaces the staring with a number, and it's the closest thing to hands-off consistency testing ComfyUI has without standing up your own embedding pipeline.
How it works
For each image in the batch, the node sends the fixed image_source plus one candidate to AWS Rekognition's CompareFaces and gets a similarity score. Three behaviors make it interesting:
- Early exit. It scores candidates in order and stops the moment one clears your
target_threshold. Hitting a 97% likeness on attempt 2 means it never burns an API call on attempts 3β8. That's the whole point of the "retry" in the name - each checked image is a paid cloud call, so stopping early is real money saved. - Best-of anyway. If nothing clears the threshold, it returns the highest scorer from what it did check.
- Full log. Every attempt (score, status, pass/fail) lands in
detail_json, so you can see the ordering that produced the winner.
The inputs that matter
image_source- the fixed reference face.image_batch- your candidates, straight off a KSampler or ImageBatch node. Only the firstmax_retriesimages get scored.target_threshold(default 95) - the score that triggers early exit. This is the dial you'll actually tune. At 95 you're demanding near-identical; at 80 you're accepting "clearly the same person."max_retries(default 5, max 20) - cap on how many images get checked. Note the asymmetry: if your batch has 12 images and you cap at 5, the last 7 never get a chance.
Outputs
best_image(IMAGE) - the winner. Wire it to a preview or Save Image; it comes back as a clean single-frame tensor.best_score(FLOAT) andattempts_used(INT) - the score and how many calls it took.threshold_met(STRING) -YESorNO. Handy if you want to branch downstream, say by only saving when it'sYES.detail_json(STRING) - per-attempt log: score, status (compared,no_face_detected,aws_error), pass/fail.
Installing
Same pack, same steps as the single compare - ComfyUI Manager search comfyui-rekogniflow, or:
cd ComfyUI/custom_nodes
git clone https://github.com/Aiconomist/comfyui-rekogniflow
cd comfyui-rekogniflow
pip install -r requirements.txt
Credentials come from a .env file in the pack folder (copy .env.example, set an AWS access key with AmazonRekognitionReadOnlyAccess, region defaults to eu-west-1). Leave the aws_* node fields blank. Restart and the node appears under image/face/aws.
Gotchas
Where people get tripped up: the "batch" is scored by batch index, not by visual quality - an ugly frame that scores highest on likeness still wins. That's by design; this node answers "who is it?", not "is it good-looking?" Also remember every image checked is a billable API call (free-ish tier: 1,000/month for a year, then ~a cent each). If you're sweeping 20 seeds, set target_threshold high enough that the early exit actually fires, or your batch mode is just the single compare with extra steps. And check detail_json before assuming a 0.0 is "no match" - it's often an aws_error wearing a mask.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| image_source | IMAGE | β | |
| image_batch | IMAGE | β | |
| aws_region | STRING | β | |
| aws_access_key | STRING | β | |
| aws_secret_key | STRING | β | |
| target_thresholdopt | FLOAT | 95.00β100 | β |
| max_retriesopt | INT | 51β20 | β |
| image_qualityopt | INT | 9550β100 | β |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| best_image | IMAGE | β |
| best_score | FLOAT | β |
| attempts_used | INT | β |
| threshold_met | STRING | β |
| detail_json | STRING | β |