MSGMSD
GMSD, now with the multi-scale brain
- image_a
- image_b
- msgmsd
Take GMSD's clever insight - score the deviation of a gradient-magnitude similarity map instead of its average - and run it across multiple downsampled scales, and you get MSGMSD. It inherits GMSD's quirk too, so get this straight before anything else: lower is better. 0.0 is pixel-identical, and like GMSD, a smaller score means the reproduction is more consistent and faithful. Invert that in your head and you'll wire the node backwards the first time. I did.
It's one of the seventeen nodes in comfyui-piq, Laurent Fainsin's wrapper around the piq library. Same pack pattern: image_a and image_b in, one FLOAT out, "piq" category, no model downloads.
How it works. MSGMSD computes gradient-magnitude similarity at several scales - the multi-scale structure that makes MS-SSIM strong - and combines them with a scale-weighting parameter (alpha, default 0.5) so fine scales and coarse scales don't get equal say. The score is still a deviation, so it punishes local inconsistency: an image that's faithful in the corners and wrecked in the middle scores worse than one that's uniformly mediocre, which is exactly the failure mode you want a metric to catch. The three beta constants and t are regularization values from the paper, and chromatic (default false) adds a color channel comparison to get MSGMSDc.
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.chromatic- flip totrueif color fidelity matters to you.reduction-mean.alpha,beta1–beta3,t- paper defaults, leave them.
The msgmsd output is a FLOAT, lower better, usually in the ~0.0–0.3 range for realistic comparisons.
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 the metric is frozen in place and fine to use.
The honest take. MSGMSD is the multi-scale upgrade for people who already trust GMSD - same sensibility, more sensitivity to scale-dependent artifacts, which is the scenario you're actually in when comparing upscaler outputs at different resolutions. If you're picking between the two, MSGMSD is the better measurement and only modestly slower. Just remember which way the number goes, and keep a learned metric in the loop when the question is taste rather than fidelity.
Inputs (10)
| 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 | |
| chromatic | BOOLEAN | false | Whether to include color features |
| alpha | FLOAT | 0.50 | Scale weighting parameter |
| beta1 | FLOAT | 0.01 | First regularization parameter |
| beta2 | FLOAT | 0.32 | Second regularization parameter |
| beta3 | FLOAT | 15.00 | Third regularization parameter |
| t | FLOAT | 170.00 | Regularization constant |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| msgmsd | FLOAT | Multi-Scale Gradient Magnitude Similarity Deviation |