code wiki / (root) / nx_semruler.nx

nx_semruler.nx

buildroot/runtime/nx_semruler.nx

14991 B299 linesdepth 11pulls 63 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_semruler.nx -- THE SEMANTIC RULER, STEP 2: measure the EXISTING descriptors on a real same-concept corpus. license_tier: ORIGINAL nx_imgsearch publishes its own gap honestly and names the order of work: {"class":"semantic-lookalike","permille":-1,"status":"UNMEASURED", "note":"... (1) build a semantic ruler from labelled same-concept pairs, (2) measure the EXISTING descriptors as the honest baseline, (3) only then a quantised learned image embedding."} nx_semruler_lib is step (1)'s decision core. THIS is step (2), and it deliberately stops short of step (3): it builds NO new descriptor and trains nothing. WHERE THE LABELS COME FROM, AND WHY THEY ARE HONEST. knowledge/media/ is one directory per subject (diora_baird, julia_kyoka, barack_obama...). Two images in the same directory are the SAME CONCEPT; two in different directories are not. That is a weak label derived from the estate's own filing, not an opinion, and it is the standard way a retrieval corpus is bootstrapped. NO LABEL IS INVENTED HERE. THE ONE NUMBER THIS EXISTS TO PRODUCE, and why it has to come first: A "SAME-CONCEPT" PAIR THAT IS ACTUALLY A NEAR-DUPLICATE MEASURES THE COPY TIER, NOT SEMANTICS. Before anyone can report a semantic recall figure, they have to know how much of the same-subject corpus is genuinely different photographs and how much is re-uploads, re-crops and re-encodes. Run a recall benchmark over an unfiltered folder of one person and it will score near 1000 permil and "prove" the engine is already semantic -- the number real, the subject wrong. So this organ reports the ADMISSIBILITY CENSUS: of all within-subject pairs, how many survive sr_pair_admissible (distinct photographs) and how many are duplicates under some dihedral transform. THE SURVIVING SET IS THE ONLY VALID DENOMINATOR for step 3. AND THE CONTROL THAT KEEPS IT HONEST. If the within-subject inadmissible count is ZERO, this corpus contains no duplicates, the predicate was never exercised on real data, and the census says so rather than reporting a clean sweep. Cross-subject pairs are sampled as the opposite control: they should be overwhelmingly ADMISSIBLE, because two different people are never near-duplicates -- if they are not, the distance is not measuring what it claims and no semantic figure built on it would mean anything.

dependencies 5 imports · 0 importers

nx_syscalls.nx nx_dir.nx nx_image_gray.nx nx_imgsearch_tier.nx nx_semruler_lib.nx nx_semruler.nx

imports: nx_syscalls.nxnx_dir.nxnx_image_gray.nxnx_imgsearch_tier.nxnx_semruler_lib.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sw sys_write nx_imgtier_new nx_imgtier_copy_init nx_imgtier_orient_init nx_imgtier_similar_init nx_imgtier_local_init kp_pack_dim nx_imgkp_query_dim sys_mmap nxa_die sys_write ↻ sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ nx_dir_list nx_openat nx_dirent_read nx_dirent_iter nx_dir_is_dotlike nx_dir_name_strlen nx_dir_arena_copy_name sys_exit ↻ nx_dir_row_at nx_dir_row_is_regular_file sr_join sr_is_image nx_img_to_gray nx_jpeg_decode_luma sys_mmap ↻

structs

none

consts

37const SR_MAXCLASS: i64 = 32
38const SR_MAXIMG: i64 = 48 // per-class image cap -- ANNOUNCED, never silent (see coverage line)
39const SR_PATHCAP: i64 = 1024
40const SR_ROWCAP: i64 = 512
41const SR_ARENA: i64 = 262144
42const SR_XPAIRS: i64 = 64 // cross-subject control pairs
43const SR_DESCCAP: i64 = 16 // i64 slots per descriptor (copy=1, orient index=1, orient query=8)

functions

45func sw(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
called by 2: snmain calls 1: sys_write
46func sn(v: i64) -> i64
called by 1: main calls 3: sys_mmapswsys_write
59func swn(p: *u8, n: i64) -> i64 { sys_write(1, p, n); return 0 }
called by 1: main calls 1: sys_write
61func sr_is_image(name: *u8, nl: i64) -> i64
called by 1: main
77func sr_join(a: *u8, b: *u8, out: *u8) -> i64
called by 1: main
88func main(argc: i64, argv: *i64) -> i64