Nodes/ComfyUI-ClipScore-Nodes/Real Image Processor
ComfyUI Node

Real Image Processor

Feed this your reference photos

By azure-dragon-ai·Created 3 years ago·Updated 2 years ago· 4
Real Image Processor
  • model
  • processor
  • images
  • REAL_FEATURES
device

The Real Image Processor (HaojihuiClipScoreRealImageProcessor) is one half of the pack's scoring pipeline, and despite the slightly ominous name, "real" just means "the reference side." You feed it the image you're treating as the standard - a photo, a source image, the thing you want to compare against - and it turns it into CLIP features that the pack's ImageScore node can measure against whatever your generator produced.

The setup is a little counterintuitive at first. This pack scores images against each other, not against a prompt. So "real" and "fake" are the two ends of a similarity measurement: real = reference, fake = generation. If you've seen "CLIP score" used to mean text-to-image alignment, forget that here - this pack's scorer never touches text at all (its Text Processor output is essentially orphaned).

How it works

Mechanically this node is identical to its sibling processors - same inputs, same code path, different output label. It takes the IMAGE tensor, converts the first frame to a PIL image, runs the PROCESSOR from the Loader (the resize/center-crop/normalize step), and calls model.encode_image:

img = processor(image)
features = model.encode_image(img.to(device))
return (features,)

The only real difference is the output type, REAL_FEATURES, which is exactly what the ImageScore node's real_features input expects. Get the wiring right and the graph reads: Loader → Real Image Processor → ImageScore.real_features, with a Fake Image Processor on the other side.

The inputs that matter

  • images - the IMAGE tensor of your reference. LoadImage is the obvious source.
  • model / processor - both come from the pack's Loader node.
  • device - cuda or cpu.

One output: REAL_FEATURES, wire it into ImageScore.

Gotchas

Same batch bug as every processor in this pack: the code reads images[0] and silently ignores the rest of the batch. One image in, one feature vector out. If you want to score a whole folder of references, you'll have to loop them through one at a time.

Also remember the score you get is only as meaningful as the reference you chose. A CLIP similarity number between a generated image and a single photo is a vibe check, not a rigorous evaluation - CLIP encodes a fairly coarse notion of "what's in the picture," so two images that both contain "a red car" can score high even when they look nothing alike. For picking between generations it's a fine tiebreaker; for judging realism, treat it skeptically.

Installing

The whole pack installs together - ComfyUI Manager (search "ComfyUI-ClipScore-Nodes"), or:

cd ComfyUI/custom_nodes
git clone https://github.com/azure-dragon-ai/ComfyUI-ClipScore-Nodes

Then restart ComfyUI. There's no requirements.txt, so you also need OpenAI's clip package in ComfyUI's Python:

pip install git+https://github.com/openai/CLIP.git

Without it you'll get ModuleNotFoundError: No module named 'clip'. And run the Loader once before this node - it's what downloads the actual CLIP weights from OpenAI on first use.

One more honest note: this pack is a single-commit, unmaintained project from January 2024, and CLIP-based scoring is a niche corner of the ecosystem these days. It works for casual comparisons; don't build your quality-assurance pipeline around it.

CategoryHaojihui/ClipScore

Inputs (4)

NameTypeDefaultDescription
modelPS_MODEL
processorPS_PROCESSOR
deviceCOMBO2 options: cuda, cpu
imagesIMAGE

Outputs (1)

NameTypeDescription
REAL_FEATURESREAL_FEATURES