MDSI
Three cheap signals fused into one strong score
- image_a
- image_b
- mdsi
MDSI (Mean Deviation Similarity Index) is what you get when you stop trusting any single visual signal and fuse three of them: gradient magnitude similarity, gradient similarity (direction, not just strength), and chromaticity. It's a classic "belt and suspenders" metric - none of the three components is fancy, but combined they beat most single-signal metrics in the benchmarks, and it does it all with plain math. Higher is better, 1.0 identical. It's one of the better traditional metrics in the pack that almost nobody has heard of.
It's a node in comfyui-piq, Laurent Fainsin's wrapper around the piq library. Same shape as the rest: image_a/image_b in, one FLOAT out, "piq" category, no model downloads.
How it works. Three local similarity maps are computed: how well the gradient magnitudes match, how well the gradient directions match, and how well the color (chromaticity) matches. These get combined with the fusion weights alpha, beta, and gamma (defaults 0.6/0.1/0.2 - note they don't sum to 1; they're tuned, not normalized), using either a sum or a product combination (combination). The combined map is then pooled into the final score with the deviation-flavored pooling parameters rho, q, and o - the same "don't let local damage hide in an average" instinct that makes GMSD good. The c1/c2/c3 constants are the usual stability constants.
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.combination-sum(default) vs.mult; test both if you're curious,sumis the paper's choice.- Everything else -
c1–c3,alpha/beta/gamma,rho,q,o- leave at defaults.
The mdsi 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 requirements file; Python 3.12+; repo archived but stable.
The honest take. MDSI is a workhorse, not a star. It won't beat LPIPS on taste and it won't beat GMSD on speed, but it's a strong, well-rounded reference metric that's sensitive to both structural and directional distortion - the kind of thing that catches rotation/shear artifacts that pure magnitude metrics miss. It's a good second opinion when you're comparing upscale candidates and the usual suspects disagree.
Inputs (14)
| Name | Type | Default | Description |
|---|---|---|---|
| image_a | IMAGE | Input image | |
| image_b | IMAGE | Reference image | |
| data_range | FLOAT | 1.00 | Maximum value range of images |
| reduction | COMBO | Reduction method | |
| c1 | FLOAT | 140.00 | First regularization constant |
| c2 | FLOAT | 55.00 | Second regularization constant |
| c3 | FLOAT | 550.00 | Third regularization constant |
| combination | COMBO | Combination method | |
| alpha | FLOAT | 0.60 | First weighting parameter |
| beta | FLOAT | 0.10 | Second weighting parameter |
| gamma | FLOAT | 0.20 | Third weighting parameter |
| rho | FLOAT | 1.00 | Exponential parameter |
| q | FLOAT | 0.25 | Pooling parameter |
| o | FLOAT | 0.25 | Exponent parameter |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| mdsi | FLOAT | Mean Deviation Similarity Index |