Nodes/ComfyUI_LayerStyle_Advance/LayerUtility: ImageRewardFilter(Advanced)
ComfyUI Node Runs on cloud

LayerUtility: ImageRewardFilter(Advanced)

ImageRewardFilter — auto-rank a batch of generations and keep the best

By chflame163·Created 2 years ago·Updated 4 months ago· 696
LayerUtility: ImageRewardFilter(Advanced)
  • images
  • images
  • obsolete_images
prompt
output_num3

Generate a batch, feed it into this node, get back the top N images sorted by a learned quality score instead of eyeballing the whole grid yourself. Under the hood it's using ImageReward, a model trained on human preference comparisons specifically for text-to-image output - the same THUDM research group behind CogVideoX and, via Zhipu/Z.ai, the GLM line this pack's other nodes also call. It's a legitimate research tool, not a gimmick, but it's genuinely niche - it doesn't come up often in community discussion, so don't expect a large body of "here's how I tuned this" advice to exist if you go looking.

How it works

Give it a batch of images and it scores each one, then splits them into two output streams: the top performers and everything that didn't make the cut, both returned in ranked order. This is the useful shape for a "generate 8, keep the best 3" pattern without a manual review step - wire the images output straight into your save node and the obsolete_images output somewhere you can still inspect them if the ranking seems off.

The inputs and outputs that matter

  • images - the batch to rank.
  • prompt - the schema lists this as required text input, though the README frames it as optional: entering a prompt here gives the scorer something to match relevance against, on top of pure image quality. Leave it blank if you want a purely aesthetic/quality ranking with no text-matching component.
  • output_num (default 3) - how many images land in the top-ranked images output; should be smaller than your batch size, obviously, or there's nothing left for the second output.

Outputs: images (the keepers, best to worst) and obsolete_images (the rejects, also ranked best to worst within that group - useful if "the cut" was close and you want a second look).

How to install it

Recommended: ComfyUI Manager, search "ComfyUI Layer Style Advance". Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/chflame163/ComfyUI_LayerStyle_Advance.git

Then install_requirements.bat / install_requirements_aki.bat, or pip install -r requirements.txt plus repair_dependency.bat. Restart.

Model download: the README credits ImageReward and its original authors but doesn't spell out a manual download path the way it does for models like BEN or SAM - expect the weights to pull automatically from Hugging Face the first time you run this node. If you're in a region where huggingface.co isn't directly reachable, the same fix the README gives elsewhere applies: set HF_ENDPOINT=https://hf-mirror.com in the huggingface_hub package before first use.

Common issues & troubleshooting

First run hangs or fails with a connection error. Almost certainly the automatic model download - see the huggingface.co mirror fix above if you're somewhere Hugging Face isn't directly reachable.

Ranking doesn't match your own taste. ImageReward was trained on general human preference data, not on you specifically - it's a reasonable automatic first pass for cutting an obviously-worse image out of a batch, not a substitute for actually looking at the output when the choice is close. Treat obsolete_images as a safety net for exactly that case rather than assuming the top pick is always the objectively "best" one.

output_num set higher than your batch size, or close to it. You'll get little or nothing meaningful in obsolete_images if there's barely anything left to reject after filling the top slots - keep output_num comfortably below your batch size if you actually want the two-way split to tell you anything.

Category😺dzNodes/LayerUtility

Inputs (3)

NameTypeDefaultDescription
imagesIMAGE
promptSTRING
output_numINT31–999999

Outputs (2)

NameTypeDescription
imagesIMAGE
obsolete_imagesIMAGE