ComfyUI Node

FSIM

The metric that scores what your eyes actually lock onto

By Laurent2916·Created about a year ago·Updated about a year ago· 0
FSIM
  • image_a
  • image_b
  • scales
  • orientations
  • min_length
  • mult
  • fsim
data_range1.00
reduction
chromatictrue
sigma_f0.55
delta_theta1.20
k2.00

Here's the thing about SSIM and its cousins: they score everything, including the vast flat areas your brain skims right past. FSIM (Feature Similarity Index) inverts the priority. It's built on phase congruency - the "dimensionless" measure of how much local structure an image has - on the theory that what your visual system actually locks onto are the points where structure is strong: edges, corners, texture boundaries. Where FSIM's feature map is strong, the metric cares a lot; where it's flat, the metric barely looks. It consistently lands near the top of the classical IQA rankings, and it's one of the best pure-math metrics you can run on a comparison.

It's a node in comfyui-piq, Laurent Fainsin's wrapper around the piq library. Standard pack shape: image_a/image_b in, one FLOAT out, "piq" category. No model downloads.

How it works. Two components. Phase congruency, computed by a bank of log-Gabor filters at multiple scales and orientations (the scales and orientations inputs, 4 and 4 by default), is the primary similarity map - it's the "where's the structure" detector. Gradient magnitude is the secondary map, computed from the same filter responses. The two local maps get pooled into per-pixel similarity and weighted by how much feature strength is actually there, so empty regions don't dilute the score. The remaining knobs - min_length, mult, sigma_f, delta_theta, k - tune the log-Gabor filter bank itself. You will never touch these, and that's correct.

Inputs a beginner actually sets:

  • image_a / image_b - candidate vs. reference.
  • data_range - 1.0 for ComfyUI's 0–1 floats.
  • chromatic - defaults to true, which upgrades FSIM to FSIMc by adding a color-similarity term on the chrominance channels. Leave it on; color information is free signal here.
  • reduction - mean.

The fsim output is a FLOAT, roughly [0, 1], higher better.

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

piq>=0.8.0 is the whole dependency list; Python 3.12+; repo archived but stable.

Where it earns its keep. FSIM is a strong pick when you're ranking candidates by detail retention - upscaler shootouts, refiner A/B tests - because it rewards the parts of the image that actually read as "sharp" and "detailed" to a human. It's slower than SSIM/GMSD but still no neural network, so it's cheap enough to run per-batch. It's not learned and it still won't judge aesthetics; pair it with a learned metric when the decision matters and the two metrics disagree, trust the pattern, not the panic.

Categorypiq

Inputs (12)

NameTypeDefaultDescription
image_aIMAGEInput image
image_bIMAGEReference image
data_rangeFLOAT1.00Maximum value range of images
reductionCOMBOReduction method
chromaticBOOLEANtrueWhether to include color features
scalesINTEGER4Number of wavelet scales
orientationsINTEGER4Number of filter orientations
min_lengthINTEGER6Minimum filter length
multINTEGER2Scale multiplication factor
sigma_fFLOAT0.55Frequency spread
delta_thetaFLOAT1.20Angular interval between filter orientations
kFLOAT2.00Scaling factor

Outputs (1)

NameTypeDescription
fsimFLOATFeature Similarity Index