DSS
The metric that brings the frequency domain to the party
- image_a
- image_b
- dct_size
- kernel_size
- dss
Most reference metrics compare images in the spatial domain - pixel neighborhoods, gradients, edges. DSS (Deep Spatial-Spectral Similarity) is the one that refuses to choose: it computes a deep feature map from each image's DCT coefficients, then compares those in the spatial domain. You get the frequency content that Fourier-style analysis captures and the locality that spatial comparison gives you. Higher is better, 1.0 identical, and it's a surprisingly strong performer given how rarely anyone mentions it.
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 model downloads - the "deep" here is a hand-designed feature pipeline, not a neural net.
How it works. The image is split into DCT blocks (that's the dct_size, default 8), and a carefully constructed filter picks out the "deep" spectral features - the coefficients that carry the most structural signal. That selection is what percentile (default 0.05) and sigma_weight control: which DCT coefficients count as important and how strongly they're weighted. The resulting spectral feature maps are then compared with a spatial similarity scheme - local gradient magnitude similarity, smoothed by a Gaussian (kernel_size, sigma_similarity) - and fused into the final score. The "deep" in the name means "combining both domains," not "learned."
Inputs a beginner actually sets:
image_a/image_b- candidate vs. reference.data_range-1.0for ComfyUI 0–1 floats.reduction-mean.dct_size,sigma_weight,kernel_size,sigma_similarity,percentile- paper defaults; you'd only touch these to trade off sensitivity to specific artifact types.
The dss 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
Single dependency (piq>=0.8.0), Python 3.12+, repo archived but stable.
The honest take. DSS is the one you reach for when you're comparing things that differ mostly in texture or high-frequency detail - compression-style artifacts, grain, upscaler hallucination - because those live in the frequency content that pure spatial metrics gloss over. It's a bit more compute than SSIM but nothing like a learned model. It's not going to replace LPIPS in anyone's heart, but if you want a strong traditional metric that thinks in both domains, DSS is quietly excellent.
Inputs (9)
| 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 | |
| dct_size | INTEGER | 8 | DCT block size |
| sigma_weight | FLOAT | 1.55 | Standard deviation for weighting |
| kernel_size | INTEGER | 3 | Size of the kernel |
| sigma_similarity | FLOAT | 1.50 | Standard deviation for similarity |
| percentile | FLOAT | 0.05 | Percentile for coefficient selection |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| dss | FLOAT | Deep Spatial-Spectral Score |