Nodes/Comfyui_image2prompt/Image Reward Score 🐼
ComfyUI Node

Image Reward Score 🐼

Image Reward Score 🐼 — ComfyUI Node Guide

By zhongpei·Created 3 years ago·Updated about a year ago· 386
Image Reward Score 🐼
  • model
  • images
  • IMAGES
  • SCORES_STR
  • SCORES_INT
prompt
top_k3

What it is

An automated culling node: generate a batch of images, score them against your prompt with a human-preference reward model, and keep only the best ones. It's built on THUDM/ImageReward, a model trained on real human preference comparisons rather than a simple aesthetic classifier - the README links it directly as the source. This isn't a dead or obscure tool either; reward-model scoring for sorting large generation folders is still a live pattern in the community, and this node is one of the more direct ways to bring it into ComfyUI itself instead of running a separate culling pass afterward.

How it works

You feed it a batch of images and the prompt they were generated from. It scores each image against that prompt using ImageReward's learned preference model, sorts them, and hands back the top top_k - both the images themselves and their scores, in two formats. This is the node you'd put right after a batch sampler when you're generating several variations per prompt and only want to keep the ones that actually match it well, instead of eyeballing a contact sheet by hand.

Inputs and outputs

  • model - an IMAGEREWARD_MODEL, from Load Image Reward Score Model. This node doesn't load ImageReward itself.
  • prompt - the text the images are being scored against. Should be the same prompt (or close to it) that generated the images, since the score measures prompt-image alignment plus general quality, not just "is this a nice picture."
  • top_k - default 3, range 1-500. How many of the highest-scoring images to keep and return.
  • images - the batch to score.

Three outputs:

  • IMAGES - the top-k images, filtered and ranked.
  • SCORES_STR - the scores as strings, useful for display or logging (feed into Show Text, for instance).
  • SCORES_INT - the scores as integers, if you need them for further logic downstream.

This node is also marked as an output node, so it's a valid endpoint in your graph on its own - you can wire it as the last step of a batch-and-cull workflow without needing to route its outputs anywhere further.

Installing it

Same pack as everything else here:

cd ComfyUI/custom_nodes
git clone https://github.com/zhongpei/Comfyui_image2prompt

Or search "Comfyui_image2prompt" in ComfyUI Manager. (The README's own install command is typo'd to a hyphenated URL - use the underscored one above.) Restart ComfyUI after installing.

You'll also need Load Image Reward Score Model wired in ahead of this node - it's the loader that actually pulls down the ImageReward weights. See that node's article for the download specifics.

Common issues

Scoring against the wrong prompt. If you've modified your prompt mid-workflow (added a LoRA trigger word, appended quality tags) but the string wired into this node's prompt input is the original, the scores won't reflect what you actually generated. Keep the prompt input pointed at the exact text used to produce the batch you're scoring.

top_k larger than your actual batch size. If you set top_k to 3 but only fed in one image, you'll just get that one image back - it's a cap, not a requirement, but it's worth checking your batch size upstream matches what you expect to filter down to.

This scores quality and alignment, not correctness. ImageReward reflects human preference on what looks good and on-prompt - it isn't a fact-checker. A technically wrong but aesthetically pleasing image can still score well. Use it to cull a large batch down to your best candidates, not as a hard pass/fail gate.

Categoryfofo🐼/image

Inputs (4)

NameTypeDefaultDescription
modelIMAGEREWARD_MODEL
promptSTRING
top_kINT31–500
imagesIMAGE

Outputs (3)

NameTypeDescription
IMAGESIMAGE
SCORES_STRSTRING
SCORES_INTINT