Tonic commited on
Commit
0bc4e70
Β·
verified Β·
1 Parent(s): d05a59c

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +88 -8
index.html CHANGED
@@ -56,15 +56,16 @@ const T={truck:12,boom:20,drone:25,detect:30,wake:31,turn:35,tdoa:40,track:47,s2
56
  const REAL_END=T.end-8+3.5;
57
  const toModel=r=>r<4?r:r<50?r+8:r<66?58+(r-50)*0.8:T.end; // targeting tail slow, then cut straight to the end once the precision circle closes
58
  const reduce=matchMedia('(prefers-reduced-motion: reduce)').matches;
59
- // real-time budget: 2 s logo intro β†’ part 1 = 39 s (data 9 s + model build) β†’ 8 s cost segue
60
- // β†’ part 2 = 34 s (field sim, targeting end-scene stretched slower) β†’ 2 s logo outro = 85 s, loops seamlessly
61
- const DATA_S=9,P1R=39,P2R=34,INTRO=2,SEG_R=8,LOGO=2,TOTAL=INTRO+P1R+SEG_R+P2R+LOGO,P1MODEL=42,P2MODEL=66;
62
- let RT=reduce?INTRO+P1R+SEG_R+11:0,rt=0,playing=!reduce,last=null,k=1,cw=0,chh=0,t=0,PART1=true,U1=0,SEG=0,MODE='intro',DPR=1;
63
  function mapTime(){const r2=RT-INTRO;
64
  if(r2<0){MODE='intro';PART1=true;SEG=0;U1=0;rt=0;t=4;return}
65
  if(r2<P1R){MODE='p1';PART1=true;SEG=0;U1=r2<DATA_S?r2:DATA_S+(r2-DATA_S)*((P1MODEL-DATA_S)/(P1R-DATA_S));rt=0;t=U1;return}
66
- if(r2<P1R+SEG_R){MODE='seg';PART1=true;SEG=(r2-P1R)/SEG_R;U1=P1MODEL;rt=0;t=4;return}
67
- if(r2<P1R+SEG_R+P2R){MODE='p2';PART1=false;SEG=1;U1=P1MODEL;rt=Math.min(P2MODEL,(r2-P1R-SEG_R)*(P2MODEL/P2R));t=toModel(rt);return}
 
68
  MODE='outro';PART1=true;SEG=1;U1=P1MODEL;rt=P2MODEL;t=T.end}
69
  mapTime();
70
 
@@ -522,6 +523,85 @@ function drawSegue(v){ // cost segue over the quiet map: theirs $600+ vs our $40
522
  T1('same $40 BOM Β· no factory needed',hx,hy+124,C.steel,10,'center',FM,500);ctx.globalAlpha=a}
523
  ctx.globalAlpha=1;
524
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
525
  function drawModel(u){
526
  ctx.fillStyle='#0B1622';ctx.fillRect(0,0,cw,chh);
527
  ctx.fillStyle='rgba(141,154,168,.12)';for(let x=20;x<W;x+=40)for(let y=20;y<H;y+=40){ctx.fillRect(X(x),Y(y),1.4*k,1.4*k)}
@@ -566,9 +646,9 @@ function ui(){$('fill').style.width=(RT/TOTAL*100)+'%';$('bar').setAttribute('ar
566
  function frame(ts){if(last===null)last=ts;const dt=Math.min(.05,(ts-last)/1000);last=ts;
567
  if(playing){RT+=dt;if(RT>=TOTAL)RT-=TOTAL} // loops seamlessly: outro logo wraps into the intro logo
568
  mapTime();if(playing)specColumn();
569
- const f=MODE==='p2'?focus():MODE==='seg'?'COST':(U1>=9&&U1<14?CLS[Math.floor((U1-9)/1.2)%CLS.length][0]:U1>=34?'DRONE':'DATA');if($('who').textContent!==f)$('who').textContent=f;
570
  $('specBox').classList.toggle('hit',MODE==='p2'&&((t>=T.detect&&t<T.detect+3)||(t>=T.s2&&t<T.s2+2)));
571
- if(MODE==='p1')drawModel(U1);else if(MODE==='seg')drawSegue(SEG);else if(MODE==='p2')draw();
572
  else drawLogo(MODE==='intro'?clamp(1-sm(.5,1.8,RT),0,1):clamp(sm(TOTAL-LOGO+.2,TOTAL-.05,RT),0,1));
573
  ui();requestAnimationFrame(frame)}
574
  $('play').onclick=()=>{if(!playing&&RT>=TOTAL)RT=0;playing=!playing};
 
56
  const REAL_END=T.end-8+3.5;
57
  const toModel=r=>r<4?r:r<50?r+8:r<66?58+(r-50)*0.8:T.end; // targeting tail slow, then cut straight to the end once the precision circle closes
58
  const reduce=matchMedia('(prefers-reduced-motion: reduce)').matches;
59
+ // real-time budget: 2 s logo intro β†’ part 1 = 39 s (data 9 s + model build) β†’ 13 s on-device perf clock
60
+ // β†’ 8 s cost segue (factory β†’ grandma's garage) β†’ part 2 = 34 s field sim β†’ 2 s logo outro = 98 s, loops seamlessly
61
+ const DATA_S=9,P1R=39,P2R=34,INTRO=2,SEG_R=8,PERF_R=13,LOGO=2,TOTAL=INTRO+P1R+PERF_R+SEG_R+P2R+LOGO,P1MODEL=42,P2MODEL=66;
62
+ let RT=reduce?INTRO+P1R+PERF_R+SEG_R+11:0,rt=0,playing=!reduce,last=null,k=1,cw=0,chh=0,t=0,PART1=true,U1=0,SEG=0,PERF=0,MODE='intro',DPR=1;
63
  function mapTime(){const r2=RT-INTRO;
64
  if(r2<0){MODE='intro';PART1=true;SEG=0;U1=0;rt=0;t=4;return}
65
  if(r2<P1R){MODE='p1';PART1=true;SEG=0;U1=r2<DATA_S?r2:DATA_S+(r2-DATA_S)*((P1MODEL-DATA_S)/(P1R-DATA_S));rt=0;t=U1;return}
66
+ if(r2<P1R+PERF_R){MODE='perf';PART1=true;SEG=0;U1=P1MODEL;rt=P2MODEL;t=T.end;PERF=(r2-P1R)/PERF_R;return}
67
+ if(r2<P1R+PERF_R+SEG_R){MODE='seg';PART1=true;SEG=(r2-P1R-PERF_R)/SEG_R;U1=P1MODEL;rt=0;t=4;return}
68
+ if(r2<P1R+PERF_R+SEG_R+P2R){MODE='p2';PART1=false;SEG=1;U1=P1MODEL;rt=Math.min(P2MODEL,(r2-P1R-PERF_R-SEG_R)*(P2MODEL/P2R));t=toModel(rt);return}
69
  MODE='outro';PART1=true;SEG=1;U1=P1MODEL;rt=P2MODEL;t=T.end}
70
  mapTime();
71
 
 
523
  T1('same $40 BOM Β· no factory needed',hx,hy+124,C.steel,10,'center',FM,500);ctx.globalAlpha=a}
524
  ctx.globalAlpha=1;
525
  }
526
+ // =================== PERF Β· on-device latency clock (73.1 s -> 0.70 s per 5-s window) ===================
527
+ // measured on ESP32-S31 @ 320 MHz over the 56 challenge clips, 56/56 decision parity vs float ONNX
528
+ // (run_m7.log kernel ladder + board_sweep_sizes.py / board_sweep_xiao.py)
529
+ const PERF_MS=[
530
+ {v:900, lab:'STOCK INT8 TFLM', sub:'> 15 min per window β€” unusable', col:'#8D9AA8'},
531
+ {v:73.1, lab:'TFLM FLOAT32', sub:'73.1 s β€” first working on-device run', col:'#F2A93B'},
532
+ {v:21.6, lab:'CUSTOM IM2COL-GEMM', sub:'21.6 s β€” hand-written RISC-V GEMM', col:'#F2A93B'},
533
+ {v:1.971,lab:'ESP-NN CONV (M3)', sub:'1.97 s β€” vendor riscv_pie kernels', col:'#EEF0EA'},
534
+ {v:1.434,lab:'+ CUSTOM SUB/MUL (M4)', sub:'1.43 s β€” custom elementwise kernels', col:'#EEF0EA'},
535
+ {v:1.311,lab:'FUSED GRAPH (M7)', sub:'1.31 s β€” deployed model @224', col:'#7F9A6A'},
536
+ {v:0.701,lab:'SQUEEZENET1.1 @128', sub:'0.70 s β€” SUB-SECOND', col:'#7F9A6A'}];
537
+ const PERF_KT=[0,.08,.22,.36,.50,.64,.78,.92]; // 8 keyframes for 7 milestones: segment i sweeps v[i] -> v[i+1], p >= .92 holds the final value
538
+ const PERF_VMIN=0.5,PERF_VMAX=1000;
539
+ function perfV(p){if(p<=0)return PERF_MS[0].v;
540
+ for(let i=0;i<PERF_KT.length-1;i++){if(p<=PERF_KT[i+1]){const u=ease(clamp((p-PERF_KT[i])/(PERF_KT[i+1]-PERF_KT[i]),0,1));
541
+ const j=Math.min(i+1,PERF_MS.length-1);
542
+ return Math.exp(Math.log(PERF_MS[i].v)+(Math.log(PERF_MS[j].v)-Math.log(PERF_MS[i].v))*u)}}
543
+ return PERF_MS[PERF_MS.length-1].v}
544
+ const fmtV=v=>v>=900?'>15 min':v>=100?Math.round(v)+' s':v>=10?v.toFixed(1)+' s':v>=1?v.toFixed(2)+' s':Math.round(v*1000)+' ms';
545
+ function perfAng(v){const f=(Math.log10(PERF_VMAX)-Math.log10(clamp(v,PERF_VMIN,PERF_VMAX)))/(Math.log10(PERF_VMAX)-Math.log10(PERF_VMIN));return (135+270*f)*Math.PI/180}
546
+ function scenePerf(p){
547
+ ctx.fillStyle='#0B1622';ctx.fillRect(0,0,cw,chh);
548
+ ctx.fillStyle='rgba(141,154,168,.12)';for(let x=20;x<W;x+=40)for(let y=20;y<H;y+=40){ctx.fillRect(X(x),Y(y),1.4*k,1.4*k)}
549
+ const ti=sm(0,.05,p);
550
+ ctx.globalAlpha=ti;
551
+ T1('ON-DEVICE INFERENCE',500,62,26,C.off,'center',FD,800);
552
+ T1('ESP32-S31 @ 320 MHz Β· one 5-s audio window Β· 56/56 decision parity vs host float ONNX',500,90,12,C.steel,'center',FM,600);
553
+ ctx.globalAlpha=1;
554
+ const V=perfV(p),cx=268,cy=336,R=180;
555
+ // right panel: milestone rows light up as the needle passes them
556
+ PERF_MS.forEach((m,i)=>{const a=sm(PERF_KT[i],PERF_KT[i]+.05,p);if(a<=0)return;
557
+ const y=146+i*52,cur=V<=m.v,flash=clamp((p-PERF_KT[i])/.06,0,1);
558
+ ctx.globalAlpha=a;
559
+ if(cur&&flash<1){ctx.save();ctx.shadowColor=m.col;ctx.shadowBlur=18*(1-flash)*k}
560
+ ctx.fillStyle=cur?m.col:'rgba(141,154,168,.4)';diamond(X(536),Y(y+7),5*k,true);
561
+ T1(m.lab,556,y+3,14,cur?m.col:C.steel,'left',FM,700);
562
+ T1(fmtV(m.v),968,y+3,17,cur?m.col:C.steel,'right',FD,800);
563
+ T1(m.sub,556,y+21,10,C.steel,'left',FM,500);
564
+ if(cur&&flash<1)ctx.restore();
565
+ ctx.globalAlpha=1});
566
+ const ra=sm(.86,.92,p);if(ra>0){ctx.globalAlpha=ra;
567
+ T1('cheaper board Β· Seeed XIAO ESP32-S3 (~$8)',556,508,11,C.steel,'left',FM,600);
568
+ T1('1.23 s @128 Β· 4.09 s @224',968,508,13,C.off,'right',FM,700);
569
+ T1('host CPU Β· ORT float32 (reference)',556,530,11,C.steel,'left',FM,600);
570
+ T1('4.13 ms',968,530,13,C.off,'right',FM,700);
571
+ ctx.globalAlpha=1}
572
+ // log-scale stopwatch dial
573
+ ctx.fillStyle='#10202F';ctx.beginPath();ctx.arc(X(cx),Y(cy),R*k,0,7);ctx.fill();
574
+ ctx.strokeStyle=C.rule;ctx.lineWidth=2;ctx.beginPath();ctx.arc(X(cx),Y(cy),R*k,0,7);ctx.stroke();
575
+ for(let d=0.1;d<=1000;d*=10)for(let m2=1;m2<=9;m2++){const v=d*m2;if(v<PERF_VMIN||v>PERF_VMAX)continue;
576
+ const a=perfAng(v),big=m2===1;
577
+ ctx.strokeStyle=big?C.steel:'rgba(141,154,168,.35)';ctx.lineWidth=big?2:1;
578
+ ctx.beginPath();ctx.moveTo(X(cx+Math.cos(a)*(R-14)),Y(cy+Math.sin(a)*(R-14)));
579
+ ctx.lineTo(X(cx+Math.cos(a)*(R-(big?28:21))),Y(cy+Math.sin(a)*(R-(big?28:21))));ctx.stroke()}
580
+ [[1000,'>15 min'],[100,'100 s'],[10,'10 s'],[1,'1 s'],[0.7,'0.7 s']].forEach(([v,s])=>{const a=perfAng(v);
581
+ T1(s,cx+Math.cos(a)*(R+24),cy+Math.sin(a)*(R+24)+4,11,C.steel,'center',FM,600)});
582
+ PERF_MS.forEach((m,i)=>{const a=perfAng(m.v),passed=V<=m.v;
583
+ ctx.globalAlpha=sm(PERF_KT[i],PERF_KT[i]+.05,p);
584
+ ctx.fillStyle=passed?m.col:'rgba(141,154,168,.4)';
585
+ ctx.beginPath();ctx.arc(X(cx+Math.cos(a)*(R-35)),Y(cy+Math.sin(a)*(R-35)),(passed?4.5:3)*k,0,7);ctx.fill();ctx.globalAlpha=1});
586
+ // needle (the animated clock hand)
587
+ const na=perfAng(V),col=V<1?C.green:C.amber;
588
+ ctx.strokeStyle=col;ctx.lineWidth=3.5;ctx.lineCap='round';
589
+ ctx.beginPath();ctx.moveTo(X(cx-Math.cos(na)*16),Y(cy-Math.sin(na)*16));ctx.lineTo(X(cx+Math.cos(na)*(R-46)),Y(cy+Math.sin(na)*(R-46)));ctx.stroke();
590
+ ctx.fillStyle=col;ctx.beginPath();ctx.arc(X(cx),Y(cy),7*k,0,7);ctx.fill();
591
+ // digital countdown in the dial's bottom opening
592
+ T1(fmtV(V),cx,cy+112,30,col,'center',FD,800);
593
+ T1('PER 5-S WINDOW',cx,cy+140,10,C.steel,'center',FM,600);
594
+ // sub-second badge + speedup counter
595
+ const bx=sm(.93,.99,p);
596
+ if(bx>0){const n=Math.round(73.1/PERF_MS[PERF_MS.length-1].v*ease(bx));
597
+ ctx.globalAlpha=bx;
598
+ ctx.fillStyle=C.green;rrect(cx-72,104,144,32,7);ctx.fill();
599
+ T1('SUB-SECOND',cx,126,14,'#08111B','center',FM,700);
600
+ T1('73.1 s β†’ 0.70 s Β· Γ—'+n+' FASTER',500,566,20,C.green,'center',FD,800);
601
+ T1('than the first working on-device run',500,590,11,C.steel,'center',FM,500);
602
+ ctx.globalAlpha=1}
603
+ }
604
+
605
  function drawModel(u){
606
  ctx.fillStyle='#0B1622';ctx.fillRect(0,0,cw,chh);
607
  ctx.fillStyle='rgba(141,154,168,.12)';for(let x=20;x<W;x+=40)for(let y=20;y<H;y+=40){ctx.fillRect(X(x),Y(y),1.4*k,1.4*k)}
 
646
  function frame(ts){if(last===null)last=ts;const dt=Math.min(.05,(ts-last)/1000);last=ts;
647
  if(playing){RT+=dt;if(RT>=TOTAL)RT-=TOTAL} // loops seamlessly: outro logo wraps into the intro logo
648
  mapTime();if(playing)specColumn();
649
+ const f=MODE==='perf'?'ESP32-S31':MODE==='p2'?focus():MODE==='seg'?'COST':(U1>=9&&U1<14?CLS[Math.floor((U1-9)/1.2)%CLS.length][0]:U1>=34?'DRONE':'DATA');if($('who').textContent!==f)$('who').textContent=f;
650
  $('specBox').classList.toggle('hit',MODE==='p2'&&((t>=T.detect&&t<T.detect+3)||(t>=T.s2&&t<T.s2+2)));
651
+ if(MODE==='p1')drawModel(U1);else if(MODE==='seg')drawSegue(SEG);else if(MODE==='p2')draw();else if(MODE==='perf')scenePerf(PERF);
652
  else drawLogo(MODE==='intro'?clamp(1-sm(.5,1.8,RT),0,1):clamp(sm(TOTAL-LOGO+.2,TOTAL-.05,RT),0,1));
653
  ui();requestAnimationFrame(frame)}
654
  $('play').onclick=()=>{if(!playing&&RT>=TOTAL)RT=0;playing=!playing};