← Documentation / SQL Reference
View DOI 1.15 on Zenodo: https://doi.org/10.5281/zenodo.22013446
New DBBuilt on the current, join-free pipeline (build_notta_tta_comp_db.py), one independent database per model.
DOI 1.11's Pixel Identity Theorem
proves SSIM=1.0 ⇒ pixel-identical ⇒ all eight
comp_* features match. This report tests the
converse, which isn't guaranteed by that proof: if the eight
features match ground truth exactly, must SSIM still equal 1.0?
Every query here is single-database — unlike
DOI 1.13's cross-model comparisons,
nothing needs to be ATTACHed — so all four
models are covered by one script that simply changes the
.open target between sections, captured in a single
continuous recording instead of one video per model.
verification_sql_final_4model.sqlWITH feature_match AS (
SELECT
(ssim_l_notta * ssim_c_notta * ssim_s_notta) AS ssim,
(CASE WHEN comp_sharpness_gt = comp_sharpness_notta THEN 1 ELSE 0 END
+ CASE WHEN comp_edges_gt = comp_edges_notta THEN 1 ELSE 0 END
+ CASE WHEN comp_artifact_ringing_gt = comp_artifact_ringing_notta THEN 1 ELSE 0 END
+ CASE WHEN comp_artifact_block_gt = comp_artifact_block_notta THEN 1 ELSE 0 END
+ CASE WHEN comp_contrast_gt = comp_contrast_notta THEN 1 ELSE 0 END
+ CASE WHEN comp_texture_gt = comp_texture_notta THEN 1 ELSE 0 END
+ CASE WHEN comp_entropy_gt = comp_entropy_notta THEN 1 ELSE 0 END
+ CASE WHEN comp_noise_gt = comp_noise_notta THEN 1 ELSE 0 END) AS n_features_matched
FROM blocks
),
all8 AS (
SELECT ssim FROM feature_match WHERE n_features_matched = 8
)
SELECT 'n_matched_8' AS metric, CAST(COUNT(*) AS VARCHAR) AS value FROM all8
UNION ALL SELECT 'pct_ssim_eq_1', CAST(ROUND(100.0*SUM(CASE WHEN ssim=1.0 THEN 1 ELSE 0 END)/COUNT(*),4) AS VARCHAR) FROM all8
UNION ALL SELECT 'pct_ssim_lt_05', CAST(ROUND(100.0*SUM(CASE WHEN ssim<0.5 THEN 1 ELSE 0 END)/COUNT(*),4) AS VARCHAR) FROM all8;
-- Repeats identically for SwinIR, High-Fidelity, and Digital-Art,
-- each preceded by its own .open line.
Sums how many of the eight comp_* fields match
ground truth exactly per block (n_features_matched),
restricts to the perfect 8/8 group, and reports what fraction of
that group actually hits SSIM=1.0 versus falls below 0.5.
Answer: conditionally yes, not universally. SwinIR:
99.97% at SSIM=1.0, effectively confirming the converse for that
model. The other three tell a different story — Standard
42.23%, Digital-Art 53.33%, and Upscayl High-Fidelity just
0.01%, with 63.05% of its feature-matched blocks actually
below 0.5.
WITH feature_match AS (
SELECT
sigma_gt, ssim_l_notta, ssim_c_notta, ssim_s_notta,
(ssim_l_notta * ssim_c_notta * ssim_s_notta) AS ssim,
(CASE WHEN comp_sharpness_gt = comp_sharpness_notta THEN 1 ELSE 0 END
+ CASE WHEN comp_edges_gt = comp_edges_notta THEN 1 ELSE 0 END
+ CASE WHEN comp_artifact_ringing_gt = comp_artifact_ringing_notta THEN 1 ELSE 0 END
+ CASE WHEN comp_artifact_block_gt = comp_artifact_block_notta THEN 1 ELSE 0 END
+ CASE WHEN comp_contrast_gt = comp_contrast_notta THEN 1 ELSE 0 END
+ CASE WHEN comp_texture_gt = comp_texture_notta THEN 1 ELSE 0 END
+ CASE WHEN comp_entropy_gt = comp_entropy_notta THEN 1 ELSE 0 END
+ CASE WHEN comp_noise_gt = comp_noise_notta THEN 1 ELSE 0 END) AS n_features_matched
FROM blocks
),
all8 AS (
SELECT
CASE WHEN sigma_gt = 0 THEN 'sigma_gt=0' ELSE 'sigma_gt>0' END AS sigma_group,
ssim, ssim_l_notta, ssim_c_notta, ssim_s_notta
FROM feature_match
WHERE n_features_matched = 8
),
stats AS (
SELECT
sigma_group,
COUNT(*) AS n,
PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY ssim) AS median_ssim,
AVG(ssim_l_notta) AS avg_l, MIN(ssim_l_notta) AS min_l, MAX(ssim_l_notta) AS max_l,
AVG(ssim_c_notta) AS avg_c, MIN(ssim_c_notta) AS min_c, MAX(ssim_c_notta) AS max_c,
AVG(ssim_s_notta) AS avg_s, MIN(ssim_s_notta) AS min_s, MAX(ssim_s_notta) AS max_s
FROM all8
GROUP BY sigma_group
)
SELECT * FROM stats;
Splits the same 8/8-matched group into σgt=0
and σgt>0, then reports the min/avg/max of
each SSIM factor (L, C, S) in both halves. Result, for every
one of the four models: the contrast term C is exactly
1.0 — min, avg, and max all identical —
in both groups. That's a new general theorem, not
restricted to the σgt=0 masking regime already
established in DOI 1.11: C=1
whenever σgt=σnotta, for any
shared value. The structure term S sits at exactly 1.0 in the
σgt=0 group and extremely close to 1.0 (a
narrow, model-dependent range) in the σgt>0
group. With C pinned and S nearly pinned, the luminance term L
is the only factor still free to vary — and its spread is
the entire content of Part 1's score divergence. The root cause
is structural, not incidental: none of the eight
comp_* features measures luminance at all, so
matching all eight can constrain C and S but says nothing about
L.