ComfyUI Node

CalculateAestheticScore

Get a number for 'does this image actually look good'

By strimmlarn·Created 3 years ago·Updated 2 years ago· 35
CalculateAestheticScore
  • image
  • aesthetic_model
  • SCORE

Judging your own generations is a losing game. You watched each one come out, you're invested in the sampler you picked, and your brain will rank the middle three in whichever order flatters the prompt you wrote. This node takes the judgment out of your hands and hands it to a model trained on a few hundred thousand human ratings. Feed it an image and an aesthetic model, and it hands you a number. That number is wrong in interesting, predictable ways - but it's honest, and honesty is the whole point.

CalculateAestheticScore is the engine of the strimmlarn aesthetic pack. It's a ComfyUI port of the Improved Aesthetic Score Predictor pipeline, and it's the node you'll wire into any "score my batch and keep the best" workflow.

How it works

The mechanism is a classic two-stage scorer. Your image gets encoded by OpenAI's CLIP ViT-L/14 into a 768-dimension embedding, that embedding gets L2-normalized, and a small MLP - four linear layers with dropout, trained on AVA human ratings - regresses it to a 1–10 aesthetic score. The node then multiplies by 100 before returning, so a 6.4 rating comes back as 640. The SCORE output is effectively 0–1000, not 1–10. Keep that in mind when you start comparing runs: "700" isn't a percentage of anything, it's "roughly a 7/10 by the dataset's standards."

Two things about that are worth knowing before you trust a single number. First, the predictor is a re-implementation of an SD 1.5-era aesthetic model, so its tastes are trained on 2022-2023 imagery. It's decent at catching composition, faces, and lighting disasters; it will not know what SDXL or Flux "good" means. Treat it as a vibe check that never gets tired, not as art criticism. Second, it only scores the first image in whatever IMAGE batch you feed it - the code grabs image[0] and ignores the rest. There's no hidden loop. Score one image per call.

Inputs and outputs

  • image (IMAGE) - the image to grade. Feed one image at a time, as noted above.
  • aesthetic_model (AESTHETIC_MODEL) - wire this from LoadAesteticModel. You can't pick the model here; the loader picks it.

The single output, SCORE, is the pack's custom type, so it won't plug straight into most other nodes. Route it through ScoreToNumber to get a plain NUMBER for WAS node suite and friends, or through AesthetlcScoreSorter to actually rank images against each other.

Install

Install the pack once and it gives you all four nodes. Via ComfyUI Manager, search "Strimmlarns" or "aesthetic score" and install. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/strimmlarn/ComfyUI-Strimmlarns-Aesthetic-Score

One wrinkle the README gets wrong: the dependency file is named requirement.txt, not requirements.txt, so pip install -r requirements.txt will fail. The real command is:

pip install -r requirement.txt

That installs OpenAI's clip straight from GitHub, which pulls in torch, torchvision, ftfy, regex, tqdm, and pillow with it. Restart ComfyUI after installing.

Common issues

The big one is CUDA. This node hard-codes .to("cuda") and torch.cuda.FloatTensor - there is no CPU fallback. If you're on a Mac or a CPU-only box it will crash, full stop. On Windows with a GPU you might hit the classic "Expected all tensors to be on same device" error that plagues this whole CLIP-scorer family; it's a device-mismatch when the model state dict loads, and the usual culprits are a stale torch or a model file saved by a different fork.

Also budget for the cold start. The node re-loads CLIP ViT-L/14 and the MLP from scratch on every execution, so your first queue run each session will pause a few seconds while it downloads nothing - the model - and loads an ~900MB encoder. It also spikes VRAM each run. If you're scoring a long batch, run it in one go and don't stare at the bar.

Categoryaestheticscore

Inputs (2)

NameTypeDefaultDescription
imageIMAGE
aesthetic_modelAESTHETIC_MODEL

Outputs (1)

NameTypeDescription
SCORESCORE