ComfyUI Node

VIFp

The metric that measures how much information actually survives

By Laurent2916·Created about a year ago·Updated about a year ago· 0
VIFp
  • image_a
  • image_b
  • vifp
sigma_n_sq2.00
data_range1.00
reduction

Most image metrics compare pixels. VIFp (Visual Information Fidelity, pixel-domain variant) asks a different, more interesting question: how much of the information in the reference image survives into the image you're testing? It's built on information theory - think of the reference as a source signal passing through a noisy "channel" (your pipeline) into your visual system. The score is the ratio of information your brain could theoretically extract from the test image versus from the perfect reference. Higher is better, 1.0 identical. It's one of the strongest classical metrics on the block, and it has exactly one knob you'll ever touch.

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

How it works. VIFp models the images with a Gaussian Scale Mixture - essentially, it breaks each image into frequency/scale bands and models how well local structure fits a Gaussian distribution, which is how it estimates "how much information is here." It then compares how much information the reference conveys about the test image against how much the reference conveys about itself. The sigma_n_sq input (default 2.0) is the assumed noise variance of the human visual system's front end - it's the one parameter you might ever adjust, and even then, bigger values just make the metric more forgiving of small differences.

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.
  • reduction - mean.
  • sigma_n_sq - leave at 2.0 unless you have a reason.

The vifp 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 entire requirements file; Python 3.12+; repo archived but stable.

The honest take. VIFp is one of the traditional metrics that correlates with human judgment unusually well, which makes it a great arbiter when comparing detail retention - upscalers, refines, super-resolution. The catch is speed: the Gaussian Scale Mixture modeling is the most expensive thing in the classical half of this pack, so it's a "verify the finalists" node, not a "score every seed" node. Use it as the tiebreaker once you've shortlisted with the cheap stuff. And pair it with a learned metric for taste; VIFp is about fidelity, not beauty.

Categorypiq

Inputs (5)

NameTypeDefaultDescription
image_aIMAGEInput image
image_bIMAGEReference image
sigma_n_sqFLOAT2.00Noise variance
data_rangeFLOAT1.00Maximum value range of images
reductionCOMBOReduction method

Outputs (1)

NameTypeDescription
vifpFLOATVisual Information Fidelity