Nodes/comfyui-rekogniflow/RekogniFlow πŸ” Face Compare (batch)
ComfyUI Node

RekogniFlow πŸ” Face Compare (batch)

Fire a whole batch at a face, keep the one that actually looks like them

By AiconomistΒ·Created 5 months agoΒ·Updated 5 months agoΒ· 7
RekogniFlow πŸ” Face Compare (batch)
  • image_source
  • image_batch
  • best_image
  • best_score
  • attempts_used
  • threshold_met
  • detail_json
β—„aws_regionβ–Ί
β—„aws_access_keyβ–Ί
β—„aws_secret_keyβ–Ί
β—„target_threshold95.0β–Ί
β—„max_retries5β–Ί
β—„image_quality95β–Ί

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:

  1. 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.
  2. Best-of anyway. If nothing clears the threshold, it returns the highest scorer from what it did check.
  3. 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 first max_retries images 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) and attempts_used (INT) - the score and how many calls it took.
  • threshold_met (STRING) - YES or NO. Handy if you want to branch downstream, say by only saving when it's YES.
  • 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.

Categoryimage/face/aws

Inputs (8)

NameTypeDefaultDescription
image_sourceIMAGEβ€”
image_batchIMAGEβ€”
aws_regionSTRINGβ€”
aws_access_keySTRINGβ€”
aws_secret_keySTRINGβ€”
target_thresholdoptFLOAT95.00–100β€”
max_retriesoptINT51–20β€”
image_qualityoptINT9550–100β€”

Outputs (5)

NameTypeDescription
best_imageIMAGEβ€”
best_scoreFLOATβ€”
attempts_usedINTβ€”
threshold_metSTRINGβ€”
detail_jsonSTRINGβ€”