code wiki / (root) / nx_imgbench.nx

nx_imgbench.nx

buildroot/runtime/nx_imgbench.nx

14852 B287 linesdepth 9pulls 21 transitivereach 0 importersview sourcekind bench
docsdependenciesstructsconstsfunctions

about

nx_imgbench.nx -- THE REVERSE-IMAGE RULER. Answers, by measurement rather than opinion, the only question that matters on the road to TinEye/Google parity: WHICH REAL-WORLD IMAGE MODIFICATIONS DOES OUR ENGINE ACTUALLY SURVIVE, AND WHICH DOES IT NOT? TinEye's whole product claim is finding MODIFIED copies -- resized, cropped, edited, colour-adjusted, watermarked. Google Lens adds semantic "looks like". Our engine's near-duplicate tier is a 64-bit GLOBAL perceptual hash (nx_phash dHash) and its looks-alike tier is an 80-dim integer edge-orientation descriptor (nx_visdesc, MPEG-7 EHD / GIST lineage). Both are GLOBAL descriptors. Global descriptors have a known, structural blind spot -- geometry. This ruler MEASURES exactly how big that blind spot is instead of asserting it, and emits a GAP QUEUE ranked worst-first that IS the build order for the next rung (the same discipline the gamebench ruler uses for the game lane). METHOD (liar-killed by construction): * a deterministic corpus of NCORP procedurally-generated multi-scale images (coarse blob field + a structural layer + fine detail) -- distinct, reproducible, no network, no fixtures on disk. * NQ of them are QUERIES. Each query is put through all 16 nx_imgxform classes. * for every (query, class): rank the transformed image against ALL NCORP originals and check whether the true source ranks #1. That is recall@1 -- the metric a reverse-image engine lives on. * ALSO report det@THRESH: would the LIVE client (threshold 10 Hamming) have returned it at all? recall@1 can be 1000 while det@10 is 0 -- "nearest but not near enough" is a silent miss in prod. * dHash (Hamming) and visdesc (L1) are measured HEAD-TO-HEAD on identical inputs, so the decision to wire the unwired descriptor tier is made on data, not taste. HONESTY BOUND, stated in the output: recall@1 against NCORP distractors is an UPPER BOUND on real-web performance. A production corpus has 10^8..10^10 distractors; a class scoring below ~900 here is already unusable, and a class scoring 1000 here is merely "not yet disproven". Composes nx_imgxform (deform) + nx_phash (hash) + nx_visdesc (describe) -- ZERO new ranking math. license_tier: ORIGINAL

dependencies 6 imports · 0 importers

nx_imgxform.nx nx_itoa_lib.nx nx_imgcorpus.nx nx_imgsearch_engine.nx nx_phash.nx nx_visdesc.nx nx_imgbench.nx

imports: nx_imgxform.nxnx_itoa_lib.nxnx_imgcorpus.nxnx_imgsearch_engine.nxnx_phash.nxnx_visdesc.nx

imported by: nobody (leaf or entry point)

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

main b_puts b_num nxi_out nxi_fd sys_mmap ccz_cat_num sys_write sys_munmap nx_imgcorpus_new nx_imgcorpus_gen ic_pos ic_rng nx_phash_dhash nx_phash_downscale nx_visdesc_extract vd_wrap_gray nx_image_alloc sys_mmap ↻ nx_image_set nx_image_sobel_x sys_mmap ↻ nx_image_convolve_3x3 nx_image_s64_alloc sys_mmap ↻ nx_image_get nx_image_s64_set nx_image_sobel_y sys_mmap ↻ nx_image_convolve_3x3 ↻ nx_image_s64_get vd_orient_bin nx_simhash_hamming nx_bits_popcount64_soft nx_imgengine_new nx_imgengine_add_tier nx_imgtier_idx_dim ie_tier_is_hash nx_imgtier_idx_dim ↻ nx_imgtier_kind

structs

none

consts

37const IB_NCORP: i64 = 256 // corpus / distractor set size
38const IB_NQ: i64 = 32 // queries put through the battery
39const IB_W: i64 = 64 // corpus image width
40const IB_H: i64 = 64 // corpus image height
41const IB_THRESH: i64 = 10 // the LIVE nx_image_search default dHash threshold (IS_DEFAULT_THRESH)
42const IB_PARITY: i64 = 900 // permille recall@1 at/above which a class counts as "survived"

functions

44func b_puts(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: b_padmain
49func b_num(v: i64) -> i64 { nxi_out(v); return 0 }
called by 2: b_padmain calls 1: nxi_out
50func b_w(fd: i64, s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(fd, s, n); return 0 }
called by 1: main
55func b_wn(fd: i64, v: i64) -> i64 { nxi_fd(fd, v); return 0 }
called by 1: main calls 1: nxi_fd
58func b_pad(v: i64, wid: i64) -> i64
called by 1: main calls 2: b_putsb_num
71func b_permille(num: i64, den: i64) -> i64 { if den <= 0 { return 0 } return num * 1000 / den }
called by 1: main
73func main() -> i64