diff options
| author | skal <pascal.massimino@gmail.com> | 2026-03-22 16:42:20 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-03-22 16:42:20 +0100 |
| commit | ba224677cbd183f6e5e592c58162383e18e8e7c7 (patch) | |
| tree | 6e27d4265320b605355a4f2a32d3d074bc03dbfd /cnn_v3/tools/tester.js | |
| parent | 31c6287f58b128f3e9a8a7bca5b09befa7fc96b5 (diff) | |
fix(cnn_v3/tools): refresh zoom canvas when new sample is loaded
Diffstat (limited to 'cnn_v3/tools/tester.js')
| -rw-r--r-- | cnn_v3/tools/tester.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/cnn_v3/tools/tester.js b/cnn_v3/tools/tester.js index 4286060..c1eb9f0 100644 --- a/cnn_v3/tools/tester.js +++ b/cnn_v3/tools/tester.js @@ -385,6 +385,7 @@ class CNNv3Tester { this.layerTextures={feat0:f0,feat1:f1,enc0:e0,enc1:e1,bn,dec1:d1,output:ot}; this.lastResult={ot,itex:this.inputTex,uDp,dispPL:this.getDisp(),w,h}; this.updateVizPanel(); + this.refreshZoom(); } destroyLayerTex(){for(const t of Object.values(this.layerTextures||{}))try{t.destroy();}catch(_){} this.layerTextures={};} @@ -492,6 +493,7 @@ class CNNv3Tester { if (!def || !tex || !this.device) return; const wrap = document.getElementById('chzoomWrap'); const lbl = document.getElementById('chzoomLbl'); + this.activeZoom = {layerId, ch, label}; lbl.textContent = label; wrap.style.display = 'flex'; // Wait for layout so clientWidth/clientHeight reflect the flex-distributed size @@ -521,6 +523,13 @@ class CNNv3Tester { }); } + refreshZoom() { + if (this.activeZoom) { + const {layerId, ch, label} = this.activeZoom; + this.zoomChannel(layerId, ch, label); + } + } + // ── Save PNG ───────────────────────────────────────────────────────────── async savePNG() { @@ -787,6 +796,7 @@ class CNNv3Tester { this.layerTextures = {feat0:f0, feat1:f1, enc0:e0, enc1:e1, bn, dec1:d1, output:ot}; this.lastResult = {ot, itex:this.inputTex, uDp, dispPL:this.getDisp(), w, h}; this.updateVizPanel(); + this.refreshZoom(); const ms = (performance.now()-t0).toFixed(1); document.getElementById('cnnLabel').textContent = `CNN output (${ms}ms)`; |
