nx_imgbench.nx
buildroot/runtime/nx_imgbench.nx
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
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
structs
| none |
consts
| 37 | const IB_NCORP: i64 = 256 // corpus / distractor set size |
| 38 | const IB_NQ: i64 = 32 // queries put through the battery |
| 39 | const IB_W: i64 = 64 // corpus image width |
| 40 | const IB_H: i64 = 64 // corpus image height |
| 41 | const IB_THRESH: i64 = 10 // the LIVE nx_image_search default dHash threshold (IS_DEFAULT_THRESH) |
| 42 | const IB_PARITY: i64 = 900 // permille recall@1 at/above which a class counts as "survived" |
functions
| 44 | func 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 } |
| 49 | func b_num(v: i64) -> i64 { nxi_out(v); return 0 } |
| 50 | func 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 |
| 55 | func b_wn(fd: i64, v: i64) -> i64 { nxi_fd(fd, v); return 0 } |
| 58 | func b_pad(v: i64, wid: i64) -> i64 |
| 71 | func b_permille(num: i64, den: i64) -> i64 { if den <= 0 { return 0 } return num * 1000 / den } called by 1: main |
| 73 | func main() -> i64 |