code wiki / (root) / nx_pose_student_distill.nx

nx_pose_student_distill.nx

buildroot/runtime/nx_pose_student_distill.nx

10242 B156 linesdepth 9pulls 24 transitivereach 0 importersview sourcekind tooltopic pose
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_f32.nx nx_f32_cvt.nx nx_f32_div.nx nx_f32_exp.nx nx_f32_conv2d.nx nx_f32_conv2d_backward.nx nx_f32_conv2d_fast.nx nx_f32_conv2d_backward_fast.nx nx_pose_cnn.nx nx_pose_student_distill.nx

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

main sys_mmap sys_openat_rd w sys_write sys_exit sys_read sys_close mk nx_f32_div nx_f32_classify nx_f32_exp_field nx_f32_mant_field nx_f32_sign nx_f32_mant_field ↻ nx_f32_exp_field ↻ nx_i32_to_f32 nx_f32_exp nx_f32_classify ↻ nx_f32_sign ↻ _f32_to_i32_rne nx_f32_classify ↻ nx_f32_sign ↻ nx_f32_exp_field ↻ nx_f32_mant_field ↻ nx_i32_to_f32 ↻ _f32_ldexp nx_f32_classify ↻ nx_f32_exp_field ↻ nx_f32_sign ↻ nx_f32_mul nx_f32_classify ↻ nx_f32_sign ↻ nx_f32_mant_field ↻ nx_f32_exp_field ↻ nx_i32_to_f32 ↻ nx_q14_to_f32 nx_i32_to_f32 ↻ nx_f32_conv2d_fast sys_mmap ↻

structs

none

consts

21const K_MAGIC_3072: i64 = 3072
22const K_MAGIC_12345: i64 = 12345
23const K_MAGIC_1103515245: i64 = 1103515245
24const K_MAGIC_2001: i64 = 2001
25const K_MAGIC_3600: i64 = 3600
26const K_MAGIC_8500: i64 = 8500
27const K_MAGIC_4900: i64 = 4900
28const K_MAGIC_300000: i64 = 300000

functions

30func w(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: wnmain calls 1: sys_write
31func 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 }
called by 1: main calls 3: wsys_mmapsys_write
32func mk(n: i64, d: i64) -> i64 { return nx_f32_div(nx_i32_to_f32(n), nx_i32_to_f32(d)) }
34func 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 }
called by 1: main calls 3: mknx_f32_gtnx_f32_mul
35func 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 }
called by 1: main calls 3: mknx_f32_gtnx_f32_mul
38func 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 }
called by 1: main calls 3: nx_f32_negnx_f32_gtnx_f32_lt
41func hm_argmax(heat: *i64, j: i64, ox: *i64, oy: *i64) -> i64
called by 1: main calls 1: nx_f32_gt
49func main() -> i64