ComfyUI Node

SRSIM

The cheap metric that knows where your eyes go

By Laurent2916·Created about a year ago·Updated about a year ago· 0
SRSIM
  • image_a
  • image_b
  • kernel_size
  • gaussian_size
  • srsim
data_range1.00
reduction
chromaticfalse
scale0.25
sigma3.80

SRSIM (Spectral Residual based Similarity) has the same instinct as FSIM - weight the score by where your eyes actually go - but gets there with a much cheaper trick. Instead of a bank of log-Gabor filters, it computes a saliency map from the spectral residual: take the image's log spectrum, subtract the averaged/smoothed spectrum, and what's left over is roughly "what's surprising about this image." That residual becomes the saliency weight for a local SSIM-style comparison. It's a smart, fast hack, and it performs remarkably well for its cost.

It's one of the seventeen nodes in comfyui-piq, Laurent Fainsin's wrapper around the piq library. Same pattern as every node here: image_a and image_b in, one FLOAT out, "piq" category, no model downloads.

How it works. The spectral residual saliency map is computed once per image (piq uses a log-Gabor filter to smooth the spectrum, which is why you see scale, sigma, kernel_size, and gaussian_size in the inputs - they tune that smoothing). Then the local similarity map - luminance, contrast, structure, same bones as SSIM - is weighted by the saliency, so surprising, detail-rich regions count more than uniform ones. chromatic (default false) upgrades it to SRSIMc, adding a chrominance comparison. Higher is better, 1.0 identical.

Inputs a beginner actually sets:

  • image_a / image_b - candidate vs. reference; image_b is ground truth.
  • data_range - 1.0 for ComfyUI's 0–1 floats.
  • chromatic - flip to true if your images are color and you want the chroma term; cheap to test both ways.
  • scale, kernel_size, sigma, gaussian_size - paper defaults, leave them.

The srsim output is a FLOAT in roughly [0, 1].

Installing. ComfyUI Manager, search "comfyui-piq", Install. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/Laurent2916/comfyui-piq.git
pip install -r custom_nodes/comfyui-piq/requirements.txt

That's the whole install: piq>=0.8.0, Python 3.12+. The repo is archived, the math isn't going anywhere.

The honest take. SRSIM is a sleeper pick. It's faster than FSIM, has the same "pay attention to the interesting parts" philosophy, and holds up in benchmark rankings better than its obscurity suggests. For iterating on upscale/refine candidates where you want a saliency-aware number without paying FSIM's cost, it's genuinely nice. It's still a traditional metric, so it won't judge whether an image looks good - only how faithfully it matches a reference where it matters. That's a job, and it does it well.

Categorypiq

Inputs (9)

NameTypeDefaultDescription
image_aIMAGEInput image
image_bIMAGEReference image
data_rangeFLOAT1.00Maximum value range of images
reductionCOMBOReduction method
chromaticBOOLEANfalseWhether to include color features
scaleFLOAT0.25Scale parameter
kernel_sizeINTEGER3Size of the kernel
sigmaFLOAT3.80Standard deviation for Gaussian kernel
gaussian_sizeINTEGER10Size of the Gaussian kernel

Outputs (1)

NameTypeDescription
srsimFLOATSpectral Residual based Similarity