nx_pose_student_distill.nx
buildroot/runtime/nx_pose_student_distill.nx
about
nx_pose_student_distill.nx -- BUILD-2 REAL DISTILLATION: our OWN sovereign student pose net learns to reproduce
the VALIDATED ViTPose TEACHER's pose on the REAL COCO image. Student = conv1(3->16,3x3,s2,p1)->ReLU->
conv2(16->48,3x3,s2,p1)->ReLU->conv3(48->17,1x1) -> 17 heatmaps [17,64,48] (4x downsample of the 256x192 input,
matching the teacher's output res). Input = the real preprocessed image (vitpose_input.bin). Targets = gaussian
bumps at the teacher's 17 keypoints (from the validated run). Trains via the gated loop (conv fwd/bwd + relu-bwd +
MSE + SGD), graded by nx_pck vs the teacher. Shows PCK 0 -> high = the student reproduces the teacher on a real
image = build-2 works at real scale (one-image overfit; generalization = train on many images = the arc).
expect_exit: 0
dependencies 12 imports · 0 importers
diagram shows first 10 each side; +2 more imports, +0 more importers in the complete lists below.
imports: nx_syscalls.nxnx_f32.nxnx_f32_cvt.nxnx_f32_div.nxnx_f32_exp.nxnx_f32_conv2d.nxnx_f32_conv2d_backward.nxnx_f32_conv2d_fast.nxnx_f32_conv2d_backward_fast.nxnx_pose_cnn.nxnx_f32_train_ops.nxnx_pck.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
| 21 | const K_MAGIC_3072: i64 = 3072 |
| 22 | const K_MAGIC_12345: i64 = 12345 |
| 23 | const K_MAGIC_1103515245: i64 = 1103515245 |
| 24 | const K_MAGIC_2001: i64 = 2001 |
| 25 | const K_MAGIC_3600: i64 = 3600 |
| 26 | const K_MAGIC_8500: i64 = 8500 |
| 27 | const K_MAGIC_4900: i64 = 4900 |
| 28 | const K_MAGIC_300000: i64 = 300000 |
functions
| 30 | func w(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 31 | func wn(v: i64) -> i64 { var m: i64=v; if m<0{w("-" as *u8);m=0-m} let t:*u8=sys_mmap(24); var k:i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var i:i64=0; let o:*u8=sys_mmap(24); while i<k{o[i]=t[k-1-i];i=i+1} sys_write(1,o,k); return 0 } |
| 32 | func mk(n: i64, d: i64) -> i64 { return nx_f32_div(nx_i32_to_f32(n), nx_i32_to_f32(d)) } |
| 34 | func leaky_relu(buf: *i64, n: i64) -> i64 { let a: i64=mk(1,100); var i: i64=0; while i<n { if nx_f32_gt(buf[i],0)==0 { buf[i]=nx_f32_mul(a, buf[i]) } i=i+1 } return 0 } |
| 35 | func leaky_relu_bwd(post: *i64, dpost: *i64, dpre: *i64, n: i64) -> i64 { let a: i64=mk(1,100); var i: i64=0; while i<n { if nx_f32_gt(post[i],0)==1 { dpre[i]=dpost[i] } else { dpre[i]=nx_f32_mul(a, dpost[i]) } i=i+1 } return 0 } |
| 38 | func f32_clip(buf: *i64, n: i64, cap: i64) -> i64 { let nc: i64=nx_f32_neg(cap); var i: i64=0; while i<n { if nx_f32_gt(buf[i],cap)==1 { buf[i]=cap } if nx_f32_lt(buf[i],nc)==1 { buf[i]=nc } i=i+1 } return 0 } |
| 41 | func hm_argmax(heat: *i64, j: i64, ox: *i64, oy: *i64) -> i64 |
| 49 | func main() -> i64 |