Nodes/CRT-Nodes/ERNIE Image Aesthetic Score (CRT)
ComfyUI Node

ERNIE Image Aesthetic Score (CRT)

Score every image 0-100 in one pass — the ERNIE aesthetic filter that curates for you

By PGCRT·Created 2 years ago·Updated 13 days ago· 132
ERNIE Image Aesthetic Score (CRT)
  • Image(s)
  • aesthetic_score
  • aesthetic_score_text
  • Best score
  • Above Threshold
Threshold50
Path Save If above threshold
Extensionjpg
attention_backendauto
keep_model_loadedfalse
offload_to_cpufalse

If you've ever run a batch of generations and wished something would just throw away the ugly ones, this is that something. ErnieImageAestheticScore scores every image in a batch from 0 to 100 using Baidu's ERNIE-Image-Aes model - an aesthetic reward model, not a generation model - and hands back the scores plus the winners. It's a curator node, the kind that turns "generate 200 images, eyeball the good ones" into "generate 200 images, keep everything above 80."

How it works

On first run it downloads baidu/ERNIE-Image-Aes from HuggingFace - the node's description says plainly that the model downloads on first use, so expect a wait and a few GB of disk. It then runs each input image through the model and reads a softmax over the model's score tokens to produce a 0–100 estimate, in batch order. You can choose the attention backend (auto prefers FlashAttention 2 when it's installed, otherwise falls back to eager), and you control what happens to the model in memory afterward.

The keep_model_loaded and offload_to_cpu toggles are worth understanding because they're the difference between "fast repeats" and "low VRAM": keeping the model resident makes the next run nearly instant but pins a chunk of VRAM, while offloading to CPU keeps it cached in system RAM instead of fully releasing it - slower than resident, faster than cold. For a one-off curation pass, leave both off and let it release everything.

The inputs that matter

  • Image(s) - the batch to score.
  • Threshold (default 50) - images scoring strictly above this make it into the Above Threshold output.
  • Path Save If above threshold - an optional output folder; anything over the threshold gets saved there, relative paths land under ComfyUI/output. Leave empty to disable saving.
  • Extension - jpg or png for whatever gets saved.

Outputs

Four of them, and they're all useful:

  • aesthetic_score - an INT list, one per input image, in batch order.
  • aesthetic_score_text - the same scores as strings, which is what you want if you're feeding them into a text preview or string pipeline.
  • Best score - the single highest-scoring image, as a plain IMAGE.
  • Above Threshold - every image that beat the threshold, batched as an IMAGE.

A common pattern: hook aesthetic_score into a boolean filter to gate a save node, and send Above Threshold on to your "keeper" folder. You can also chain it in a loop - generate a batch, score it, keep only the top slice, and use the best image as the seed for a refinement pass.

Install

Standard CRT-Nodes install:

cd ComfyUI/custom_nodes
git clone https://github.com/PGCRT/CRT-Nodes
pip install -r requirements.txt

Or ComfyUI Manager → search CRT-Nodes, then restart. This node is one of the few in the pack that genuinely needs the heavy requirements - it uses HuggingFace transformers, so if you skipped parts of requirements.txt to avoid bloat, make sure transformers and accelerate are installed or the node won't import. And remember: the first scoring run is a model download, not a hang.

CategoryCRT/Image Scorer

Inputs (7)

NameTypeDefaultDescription
Image(s)IMAGE
ThresholdINT501–99Images with a rounded score strictly greater than this value are returned and optionally saved.
Path Save If above thresholdSTRINGOptional output folder for images above Threshold. Relative paths are resolved below ComfyUI/output; leave empty to disable saving.
ExtensionCOMBOjpg2 options: jpg, png
attention_backendCOMBOautoAttention implementation used when loading ERNIE. Auto prefers FlashAttention 2 when installed and compatible, otherwise eager attention.
keep_model_loadedBOOLEANfalseKeep the model resident on the active device after scoring for faster subsequent runs at the cost of VRAM.
offload_to_cpuBOOLEANfalseWhen keep_model_loaded is off, retain the cached model on CPU instead of releasing it completely. This reduces reload time but uses system RAM.

Outputs (4)

NameTypeDescription
aesthetic_scoreINT
aesthetic_score_textSTRING
Best scoreIMAGE
Above ThresholdIMAGE