summaryrefslogtreecommitdiff
path: root/doc/CNN_V2_WEB_TOOL.md
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-13 11:44:41 +0100
committerskal <pascal.massimino@gmail.com>2026-02-13 11:44:41 +0100
commitc27b34279c0d1c2a8f1dbceb0e154b585b5c6916 (patch)
tree5918fbaadad369ec8213df1682919ebaf9f57b56 /doc/CNN_V2_WEB_TOOL.md
parent6ca832296a74b3a3342320cf4edaa368ebc56afe (diff)
CNN v2 Web Tool: Unify layer terminology and add binary format spec
- Rename 'Static (L0)' → 'Static' (clearer, less confusing) - Update channel labels: 'R/G/B/D' → 'Ch0 (R)/Ch1 (G)/Ch2 (B)/Ch3 (D)' - Add 'Layer' prefix in weights table for consistency - Document layer indexing: Static + Layer 1,2,3... (UI) ↔ weights.layers[0,1,2...] - Add explanatory notes about 7D input and 4-of-8 channel display - Create doc/CNN_V2_BINARY_FORMAT.md with complete .bin specification - Cross-reference spec in CNN_V2.md and CNN_V2_WEB_TOOL.md Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Diffstat (limited to 'doc/CNN_V2_WEB_TOOL.md')
-rw-r--r--doc/CNN_V2_WEB_TOOL.md45
1 files changed, 24 insertions, 21 deletions
diff --git a/doc/CNN_V2_WEB_TOOL.md b/doc/CNN_V2_WEB_TOOL.md
index 2fbc70e..81549ab 100644
--- a/doc/CNN_V2_WEB_TOOL.md
+++ b/doc/CNN_V2_WEB_TOOL.md
@@ -49,9 +49,11 @@ Browser-based WebGPU tool for validating CNN v2 inference with layer visualizati
**3. Visualization Modes**
**Activations Mode:**
-- 4 grayscale views per layer (channels 0-3)
+- 4 grayscale views per layer (channels 0-3 of up to 8 total)
- WebGPU compute → unpack f16 → scale → grayscale
-- Auto-scale: Layer 0 (static) = 1.0, CNN layers = 0.2
+- Auto-scale: Static features = 1.0, CNN layers = 0.2
+- Static features: Shows R,G,B,D (first 4 of 8: RGBD+UV+sin+bias)
+- CNN layers: Shows first 4 output channels
**Weights Mode:**
- 2D canvas rendering per output channel
@@ -78,6 +80,21 @@ For each CNN layer i:
Compute (ping-pong) → copy to layerTextures[i+1]
```
+### Layer Indexing
+
+**UI Layer Buttons:**
+- "Static" → layerOutputs[0] (7D input features)
+- "Layer 1" → layerOutputs[1] (CNN layer 1 output, uses weights.layers[0])
+- "Layer 2" → layerOutputs[2] (CNN layer 2 output, uses weights.layers[1])
+- "Layer N" → layerOutputs[N] (CNN layer N output, uses weights.layers[N-1])
+
+**Weights Table:**
+- "Layer 1" → weights.layers[0] (first CNN layer weights)
+- "Layer 2" → weights.layers[1] (second CNN layer weights)
+- "Layer N" → weights.layers[N-1]
+
+**Consistency:** Both UI and weights table use same numbering (1, 2, 3...) for CNN layers.
+
---
## Known Issues
@@ -192,26 +209,12 @@ For each CNN layer i:
## Binary Weight Format
-**Header (16 bytes):**
-```
-u32 magic; // 0x32_4E_4E_43 ("CNN2")
-u32 version; // Format version
-u32 num_layers; // Layer count
-u32 total_weights;// Total f16 weight count
-```
-
-**Layer Info (20 bytes × N):**
-```
-u32 kernel_size; // 3, 5, 7, etc.
-u32 in_channels; // Input channel count
-u32 out_channels; // Output channel count
-u32 weight_offset; // Offset in f16 units
-u32 weight_count; // Number of f16 weights
-```
+See `doc/CNN_V2_BINARY_FORMAT.md` for complete specification.
-**Weights (variable):**
-- Packed f16 pairs as u32 (lo 16 bits, hi 16 bits)
-- Sequential storage: [layer0_weights][layer1_weights]...
+**Quick Summary:**
+- Header: 16 bytes (magic, version, layer count, total weights)
+- Layer info: 20 bytes × N (kernel size, channels, offsets)
+- Weights: Packed f16 pairs as u32
---