MS-SSIM
SSIM that bothered to look at more than one scale
- image_a
- image_b
- kernel_size
- ms_ssim
Plain SSIM scores one image at one resolution, which is a bit like judging a photograph from a single distance. MS-SSIM (Multi-Scale Structural Similarity) is the fix: it runs the SSIM machinery across five progressively downsampled versions of the image and combines the contrast comparisons from each scale with a final structure term at the smallest one. Higher is better, 1.0 is identical, and in the papers it consistently correlates with human opinion a little better than single-scale SSIM - especially when the two images you're comparing were rendered at different effective scales, which is basically every upscaler comparison you've ever seen.
It's one of the seventeen nodes in comfyui-piq, Laurent Fainsin's wrapper around the piq PyTorch library. Same pack pattern as the rest: image_a and image_b in, one FLOAT out, everything under the "piq" category. No weights, no downloads, runs in a few milliseconds on CPU.
How it works. The image gets repeatedly low-pass filtered and downsampled by 2 until you've got five scales. Each scale contributes a contrast comparison, and the finest scales' structure term and the coarsest scales' luminance term are multiplied together with the empirically-tuned weights from the original MS-SSIM paper. That's what makes it a single pooled score instead of five separate ones. The k1/k2 constants are the same stability constants SSIM uses - you won't touch them.
Inputs worth knowing:
data_range- leave at1.0. ComfyUI hands you floats in 0–1 and piq needs to know the max value range or every score drifts.kernel_size/kernel_sigma- 11 and 1.5, the canonical Gaussian window. Leave them.reduction-meanis what you want for a single comparable number.image_a/image_b- your candidate vs. your reference.image_bis the ground truth.
The ms_ssim output is a FLOAT in [0, 1]. A good pair of generations typically sits in the high 0.9s.
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
The requirements file is one line: piq>=0.8.0, and the pack wants Python 3.12+. The repo is archived but these are frozen, stable metrics - that's fine.
The honest take. MS-SSIM is a genuinely better SSIM and still a traditional metric. It'll tell you which of two upscales kept more fine-scale structure intact, and it's less fooled by global shifts than PSNR. But it's still not perceptual: it has no idea what a face is, what text is, or what a rendering artifact looks like. Use it as the rigorous sidekick to SSIM when you're A/B testing upscalers or VAEs at different resolutions, and keep a learned metric (LPIPS, DISTS) in the graph when the question is "which one actually looks better." Traditional and learned metrics disagree all the time - that disagreement is information, not a bug.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| image_a | IMAGE | Input image | |
| image_b | IMAGE | Reference image | |
| kernel_size | INTEGER | 11 | Size of the Gaussian kernel |
| kernel_sigma | FLOAT | 1.50 | Standard deviation of the Gaussian kernel |
| data_range | FLOAT | 1.00 | Maximum value range of images |
| reduction | COMBO | Reduction method | |
| k1 | FLOAT | 0.01 | First stability constant |
| k2 | FLOAT | 0.03 | Second stability constant |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| ms_ssim | FLOAT | Multi-Scale Structural Similarity Index |