nx_render_target_match.nx
buildroot/runtime/nx_render_target_match.nx
about
nx_render_target_match.nx -- did the generated image match the target?
Universal RENDERED-VS-TARGET verdict primitive. Given two 16-element
feature vectors (target image + rendered image), emits a sealed-enum
verdict + per-axis divergence + actionable next-axis pinpoint.
USE CASES (all the same substrate, different target sources):
1. RETAIL VIRTUAL TRY-ON (Google Shopping AI Mode pattern):
target = product image (lingerie / dress / jacket / shoes)
render = model wearing the product (via gen-img)
verdict = did the rendered model faithfully wear the product?
action = which visual axis (color / texture / silhouette / etc.)
needs another iteration?
2. VIDEO-GAME ASSET RENDER:
target = concept art reference for a weapon / armor / character
render = in-engine model the procgen produced
verdict = does the asset match the brief?
3. STORY-DRIVEN SCENE RENDER (legal adult or all-ages):
target = reference image for the desired scene mood
render = generated scene image
verdict = does the render hit the mood?
All three use the SAME primitive. Different in the prompt + concept-
embedding upstream; identical at the measure-the-output layer.
COMPOSES:
nx_cosine_similarity -- overall vector alignment
per-axis delta math -- normalized |target - rendered| per axis
sealed verdict bands -- substrate-honest routing
worst-axis pinpoint -- which axis to refactor next render
genealogy_id: salton_1971_smart + clip_score_hessel_2021 +
ip_adapter_ye_2023 + lpips_zhang_2018 +
fid_heusel_2017
lineage_id: render_target_match_q10
dependencies 4 imports · 1 importers
imports: nx_syscalls.nxnx_tier.nxnx_image_feature_extract.nxnx_cosine_similarity.nx
imported by: nx_render_target_match_test.nx
structs
| 81 | struct RenderTargetMatchReport |
consts
| 51 | const NX_RTM_Q: nx_int = 1024 |
| 54 | const NX_RTM_MATCH_FAILED: nx_int = 0 // cos < 256 or fidelity below floor |
| 55 | const NX_RTM_MATCH_POOR: nx_int = 1 // 256 <= cos < 512 |
| 56 | const NX_RTM_MATCH_PARTIAL: nx_int = 2 // 512 <= cos < 768 |
| 57 | const NX_RTM_MATCH_GOOD: nx_int = 3 // 768 <= cos < 921 |
| 58 | const NX_RTM_MATCH_EXCELLENT: nx_int = 4 // cos >= 921 AND worst-axis-delta tight |
| 59 | const NX_RTM_N_VERDICTS: nx_int = 5 |
| 63 | const NX_RTM_ACTION_SHIP: nx_int = 0 |
| 64 | const NX_RTM_ACTION_REFINE_COLOR: nx_int = 1 |
| 65 | const NX_RTM_ACTION_REFINE_LIGHTING: nx_int = 2 |
| 66 | const NX_RTM_ACTION_REFINE_COMPOSITION: nx_int = 3 |
| 67 | const NX_RTM_ACTION_REFINE_CLARITY: nx_int = 4 |
| 68 | const NX_RTM_ACTION_REFINE_SHARPNESS: nx_int = 5 |
| 69 | const NX_RTM_ACTION_REFINE_FRACTAL: nx_int = 6 |
| 70 | const NX_RTM_ACTION_REFINE_SYMMETRY: nx_int = 7 |
| 71 | const NX_RTM_ACTION_RESTART_FROM_SCRATCH: nx_int = 8 |
| 72 | const NX_RTM_N_ACTIONS: nx_int = 9 |
| 75 | const NX_RTM_AXIS_TOLERANCE_Q10: nx_int = 200 // 20% of full scale |
| 79 | const NX_RTM_EXCELLENT_MAX_AXIS_DELTA: nx_int = 100 |
functions
| 95 | func _rtm_axis_to_action(axis: nx_int) -> nx_int called by 1: nx_render_target_match |
| 110 | func _rtm_abs(x: nx_int) -> nx_int called by 1: nx_render_target_match |
| 117 | func nx_render_target_match(target_features: *nx_int, |
| 199 | func nx_render_target_match_verdict_is_valid(v: nx_int) -> nx_int called by 1: main |
| 205 | func nx_render_target_match_action_is_valid(a: nx_int) -> nx_int called by 1: main |