ComfyUI Node

DSS

The metric that brings the frequency domain to the party

By Laurent2916·Created about a year ago·Updated about a year ago· 0
DSS
  • image_a
  • image_b
  • dct_size
  • kernel_size
  • dss
data_range1.00
reduction
sigma_weight1.55
sigma_similarity1.50
percentile0.05

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.0 for 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.

Categorypiq

Inputs (9)

NameTypeDefaultDescription
image_aIMAGEInput image
image_bIMAGEReference image
data_rangeFLOAT1.00Maximum value range of images
reductionCOMBOReduction method
dct_sizeINTEGER8DCT block size
sigma_weightFLOAT1.55Standard deviation for weighting
kernel_sizeINTEGER3Size of the kernel
sigma_similarityFLOAT1.50Standard deviation for similarity
percentileFLOAT0.05Percentile for coefficient selection

Outputs (1)

NameTypeDescription
dssFLOATDeep Spatial-Spectral Score