Nodes/AI Fashion Studio/Rank Candidates
ComfyUI Node

Rank Candidates

The node that picks the winner, and the weights are worth knowing

By KillPhantom·Created about a month ago·Updated about a month ago· 0
Rank Candidates
  • candidate_images
  • candidate_set
  • evaluations
  • selected_image
  • ranking
  • ranking_json

Every pipeline needs a decision point, and this is AI Fashion Studio's. It takes the candidate images plus their evaluations, picks the single best one with a deterministic formula, and hands you a selected_image plus a ranking record that every downstream node - scene edit, image-to-video, export - treats as "the answer." It's the one node in the mock slice that's not a mock: this ranking logic is the real thing, and it runs the same way whether the evaluations came from the free hash-scorer or the paid gpt-5.5 judge.

Mechanically it's simple and strict. It pairs up the candidate_set and evaluations by candidate ID, verifies the run IDs match, confirms every candidate has an evaluation, and sorts by final_score descending with deterministic tie-breaking (lower index first, then ID). The winner becomes selected_image, sliced out of the batch as a single frame. Two failure modes are worth knowing because they're the pack being careful: mismatched run IDs raise, and a missing evaluation for any candidate raises with a list of who's missing. It will not silently rank a half-evaluated set.

The real content here is the final_score formula, which lives in the evaluation contract and is the pack's philosophy as arithmetic:

  • 45% garment fidelity - how exactly the rendered garment matches the product
  • 20% anatomy quality
  • 15% model identity
  • 10% aesthetic quality
  • 10% technical image quality

Fidelity outweighs everything else combined. That's the "product fidelity takes priority over creative quality" principle from the README, made concrete. If you're trying to understand why candidate #2 beat the prettier #3, this is why - aesthetics is a tenth of the vote.

Inputs are the three you'd expect: candidate_images, candidate_set, and evaluations. Outputs are selected_image (a single-frame IMAGE - this is what you preview, send to scene edit, or animate), ranking (an AFS_RANKING_RESULT with selected_candidate_id, selected_index, selected_score, and the full ordered_candidate_ids), and ranking_json for inspection.

Since this node is provider-agnostic, it's also the natural place to mix stages. A common rehearsal pattern: mock candidate generation + live gpt-5.5 evaluation + this ranker, to test the real QA path at lower cost than a full live run. The ranker doesn't care who scored what, only that the contracts line up.

It lives under AI Fashion Studio / Mock MVP and needs nothing beyond the pack itself - no key, no API, no models. Install via Manager ("AI Fashion Studio") or clone into custom_nodes and restart.

Where people get burned, it's usually upstream: you run evaluation with a different candidate set than the one that produced the images, and the run-ID mismatch blows up here, right when you thought you were done. The fix is always the same - regenerate the set and the evaluations from one uninterrupted chain, Load Product Assets → try-on → evaluation → rank. Keep that chain intact and this node is quietly, boringly reliable, which is exactly what you want from a decision point.

CategoryAI Fashion Studio/Mock MVP

Inputs (3)

NameTypeDefaultDescription
candidate_imagesIMAGE
candidate_setAFS_CANDIDATE_SET
evaluationsAFS_EVALUATION_SET

Outputs (3)

NameTypeDescription
selected_imageIMAGE
rankingAFS_RANKING_RESULT
ranking_jsonSTRING