Image Processor
The Image Processor nobody's scoring with — and why
- model
- processor
- images
- IMAGE_FEATURES
If you googled this node expecting it to be the scoring workhorse of the ComfyUI-ClipScore-Nodes pack, here's the honest first sentence: it isn't. The Image Processor (HaojihuiClipScoreImageProcessor) encodes an image into CLIP feature vectors, which sounds central - and then its output, IMAGE_FEATURES, has no consumer anywhere in the pack. The pack's actual scorer, ImageScore, doesn't accept IMAGE_FEATURES; it takes REAL_FEATURES and FAKE_FEATURES from the Real and Fake image processors instead. So this node is the odd one out: a perfectly fine feature extractor whose output this pack can't score.
That's not to say it's useless. If you want CLIP embeddings of an image for anything else - a custom comparison, clustering, feeding another node pack - this gives you exactly that. Just know the pack itself never uses what it produces.
How it works
This pack uses OpenAI's CLIP (the same encoder lineage that conditions your SD 1.5 and SDXL prompts - CLIP is, among other things, the "similarity" model behind image-text alignment). This processor runs an image through it:
numpy = images[0].numpy()
image = transforms.ToPILImage()(transforms.ToTensor()(numpy))
img = processor(image)
features = model.encode_image(img.to(device))
Roughly: take the incoming IMAGE tensor, hand it to the PROCESSOR from the Loader (resize, crop, normalize), and run model.encode_image to get a feature vector that lives in the same space as every other CLIP embedding.
The inputs that matter
- images - an
IMAGEtensor, straight from whatever node produced the image (VAE decode, LoadImage, PreviewImage chain). - model / processor - both come from the pack's Loader node. Wire the Loader's two outputs here. Don't be clever and reuse ComfyUI's built-in CLIP loader; the sockets are typed to the pack's own
PS_MODEL/PS_PROCESSORand only accept those. - device -
cudaorcpu.
Output is one socket, IMAGE_FEATURES, holding the CLIP embedding (plus a lot of debug print(images.shape) noise in the console - the source prints shapes on every run, which is harmless but chatty).
The gotcha that will bite you
Look at that code again: images[0]. This node only ever encodes the first image in the batch. Feed it a batch of four generated images and you get features for image zero; the other three are silently ignored. If you want per-image features for scoring a batch, you're better off using the Real or Fake processors' pattern one image at a time, or wiring your own loop. It's a hard limitation of the shipped code, not a setting you missed.
Installing
Same story as the rest of the pack: install via ComfyUI Manager (search "ComfyUI-ClipScore-Nodes") or git clone https://github.com/azure-dragon-ai/ComfyUI-ClipScore-Nodes into custom_nodes/, restart, and - because the pack ships no requirements.txt - install OpenAI's CLIP package manually into ComfyUI's Python:
pip install git+https://github.com/openai/CLIP.git
Skip that and you'll hit No module named 'clip' at runtime. The Loader pulls the actual CLIP weights from OpenAI on its first run, so run that node once before any of the processors.
Bottom line: the Image Processor is a capable CLIP feature extractor with a quirk (first image only) and a dead-end output in its own pack. If your goal is an actual score, skip it and wire Real/Fake processors straight into ImageScore instead.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| model | PS_MODEL | — | |
| processor | PS_PROCESSOR | — | |
| device | COMBO | 2 options: cuda, cpu | |
| images | IMAGE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE_FEATURES | IMAGE_FEATURES | — |