Module metrics

Module metrics 

Source
Expand description

Quality metrics for image comparison.

This module provides perceptual quality metrics for comparing reference and test images. Supported metrics:

  • DSSIM: Structural dissimilarity metric (lower is better, 0 = identical)
  • SSIMULACRA2: Perceptual similarity metric (higher is better, 100 = identical)
  • Butteraugli: Perceptual difference metric (lower is better, <1.0 = imperceptible)
  • PSNR: Peak Signal-to-Noise Ratio (higher is better) - NOT RECOMMENDED

Prefer SSIMULACRA2 or Butteraugli over PSNR. PSNR does not correlate well with human perception. SSIMULACRA2 and Butteraugli are designed to match human visual perception of image quality.

§Perception Thresholds

Based on empirical data from imageflow:

LevelDSSIMSSIMULACRA2ButteraugliDescription
Imperceptible< 0.0003> 90< 1.0Visually identical
Marginal< 0.0007> 80< 2.0Only A/B comparison reveals
Subtle< 0.0015> 70< 3.0Barely noticeable
Noticeable< 0.003> 50< 5.0Visible on inspection
Degraded>= 0.003<= 50>= 5.0Clearly visible artifacts

Modules§

butteraugli
Butteraugli metric calculation.
dssim
DSSIM (Structural Dissimilarity) metric calculation.
ssimulacra2
SSIMULACRA2 metric calculation.

Structs§

MetricConfig
Configuration for which metrics to calculate.
MetricResult
Results from metric calculations.

Enums§

PerceptionLevel
Perceptual quality level based on metric thresholds.

Functions§

calculate_psnr
Calculate PSNR between two images.