IW-SSIM
The information-theoretic SSIM nobody wants to compute
- image_a
- image_b
- kernel_size
- blk_size
- iw_ssim
SSIM treats every pixel region as equally important. IW-SSIM (Information-Weighted SSIM) is the 2011 refinement that says: no - regions with more visual information should count for more. It's from the same Wang lab, it's the strongest of the pure SSIM family, and it's also the slowest and most finicky. You reach for it when you need the gold standard traditional metric for a paper, a benchmark, or a really serious A/B test - not when you want a quick sanity check.
It's one of the seventeen nodes in comfyui-piq, Laurent Fainsin's wrapper around the piq library. Same shape as every node in the pack: image_a and image_b in, a single FLOAT out, all under the "piq" category.
How it works. Beyond the usual SSIM machinery, IW-SSIM computes an information-content weight for each local block. Blocks with richer structure carry more of the signal (texture, edges, fine detail) and get weighted up; flat sky and walls get weighted down. It runs this on multiple scales - that's what the parent flag does, whether to include information from parent (coarser) scales, which you want on - using a noise-variance model (sigma_nsq, default 0.4) to estimate how much information survives the "channel." The result is a score in [0, 1], higher better, where the fine details that actually determine perceived quality punch above their pixel count.
Inputs a beginner actually sets:
image_a/image_b- candidate vs. reference;image_bis ground truth.data_range-1.0, because ComfyUI tensors are 0–1 floats.- Everything else -
kernel_size,kernel_sigma,k1,k2,blk_size,sigma_nsq,parent,reduction- leave at defaults. These are paper-tuned values.blk_sizeis the block size the information weighting runs over;sigma_nsqis the assumed noise variance in the information model. Tune them only if you know exactly why you're tuning them.
The iw_ssim output is a FLOAT in [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
Single dependency (piq>=0.8.0), Python 3.12+. The repo is archived but the math is frozen.
The honest take. IW-SSIM's advantage over plain SSIM is real but modest for day-to-day use, and it's noticeably slower - the information weighting adds a real cost at high resolutions. If you're comparing a handful of upscale candidates and want to be rigorous, sure, run it next to MS-SSIM and take the consensus. If you're iterating a workflow and need a number in under a second, SSIM or GMSD will get you 90% of the signal for 5% of the compute. It's a specialist node, and there's nothing wrong with that.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| image_a | IMAGE | Input image | |
| image_b | IMAGE | Reference image | |
| data_range | FLOAT | 1.00 | Maximum value range of images |
| kernel_size | INTEGER | 11 | Size of the Gaussian kernel |
| kernel_sigma | FLOAT | 1.50 | Standard deviation of the Gaussian kernel |
| k1 | FLOAT | 0.01 | First stability constant |
| k2 | FLOAT | 0.03 | Second stability constant |
| parent | BOOLEAN | true | Use parent weights |
| blk_size | INTEGER | 3 | Block size for information weighting |
| sigma_nsq | FLOAT | 0.40 | Noise variance |
| reduction | COMBO | Reduction method |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| iw_ssim | FLOAT | Information-Weighted Structural Similarity Index |