HaarPSI
A perceptual metric that's fast enough to run everywhere
- image_a
- image_b
- scales
- haar_psi
HaarPSI (Haar Perceptual Similarity Index) is the metric that says "perceptual similarity doesn't need a neural network." It runs the image through a Haar wavelet decomposition - the cheapest wavelet there is - and scores local similarity on the wavelet coefficients, weighted by how much signal each location actually carries. The result is a genuinely perceptual-ish score (higher better, 1.0 identical) that costs a fraction of a learned model and beats most of the classical field on correlation with human opinion.
It's one of the seventeen nodes 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 downloads.
How it works. A Haar wavelet transform decomposes each image into low-frequency approximation and high-frequency detail coefficients at multiple scales (the scales input, default 3 - with subsample on, which is the standard). The high-frequency coefficients catch edges and texture; the low-frequency ones carry the coarse structure. Local similarities are computed on the coefficients and fused with a weighting derived from the coefficient magnitudes themselves - strong responses, which are the parts your visual system actually attends to, count more. The c (stability, default 30) and alpha (weighting, default 4.2) constants are from the paper. The whole thing is wavelet math on small kernels, so it's fast.
Inputs a beginner actually sets:
image_a/image_b- candidate vs. reference;image_bis ground truth.data_range-1.0for ComfyUI's 0–1 floats.reduction-mean.scales,subsample,c,alpha- leave at defaults; these are tuned to the original validation.
The haar_psi output is a FLOAT in [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
Single dependency (piq>=0.8.0), Python 3.12+, repo archived but stable.
The honest take. If you want the most perceptual signal per millisecond from the traditional half of this pack, HaarPSI is a strong candidate. It's the kind of node you can drop into a batch-evaluation workflow without noticing the cost - run it over an entire grid of seeds and sort by score. It won't have the taste of a learned metric like LPIPS, but it also won't need a ~500 MB model download or a GPU to keep up. For "sort these 200 candidates," it's quietly ideal.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| image_a | IMAGE | Input image | |
| image_b | IMAGE | Reference image | |
| data_range | FLOAT | 1.00 | Maximum value range of images |
| scales | INTEGER | 3 | Number of wavelet scales |
| subsample | BOOLEAN | true | Whether to perform subsampling |
| c | FLOAT | 30.00 | Stability constant |
| alpha | FLOAT | 4.20 | Weighting factor |
| reduction | COMBO | Reduction method |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| haar_psi | FLOAT | Haar Perceptual Similarity Index |