summaryrefslogtreecommitdiff
path: root/tools/cnn_v2_test/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'tools/cnn_v2_test/index.html')
-rw-r--r--tools/cnn_v2_test/index.html29
1 files changed, 21 insertions, 8 deletions
diff --git a/tools/cnn_v2_test/index.html b/tools/cnn_v2_test/index.html
index bfc91c5..9ce3d8c 100644
--- a/tools/cnn_v2_test/index.html
+++ b/tools/cnn_v2_test/index.html
@@ -669,7 +669,8 @@ class CNNTester {
let html = `
<div style="margin-bottom: 12px;">
<div><strong>File Size:</strong> ${(fileSize / 1024).toFixed(2)} KB</div>
- <div><strong>Layers:</strong> ${layers.length}</div>
+ <div><strong>CNN Layers:</strong> ${layers.length}</div>
+ <div style="font-size: 9px; color: #808080; margin-top: 4px;">Static features (input) + ${layers.length} conv layers</div>
</div>
<table>
<thead>
@@ -684,11 +685,12 @@ class CNNTester {
<tbody>
`;
+ // Display layers as "Layer 1", "Layer 2", etc. (matching visualization button labels)
for (let i = 0; i < layers.length; i++) {
const l = layers[i];
html += `
<tr>
- <td>${i + 1}</td>
+ <td>Layer ${i + 1}</td>
<td>${l.inChannels}→${l.outChannels} (${l.kernelSize}×${l.kernelSize})</td>
<td>${l.weightCount}</td>
<td>${l.min.toFixed(3)}</td>
@@ -1011,9 +1013,12 @@ class CNNTester {
</div>
`;
+ html += '<div style="font-size: 9px; color: #808080; margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid #404040;">Static features (7D input) + ${this.weights.layers.length} CNN layers. Showing first 4 of 8 channels.</div>';
+
html += '<div class="layer-buttons">';
for (let i = 0; i < this.layerOutputs.length; i++) {
- const label = i === 0 ? 'Static (L0)' : `Layer ${i}`;
+ // Visualization layers: Static features (i=0), CNN Layer 1 (i=1), CNN Layer 2 (i=2), ...
+ const label = i === 0 ? 'Static' : `Layer ${i}`;
html += `<button onclick="tester.visualizeLayer(${i})" id="layerBtn${i}">${label}</button>`;
}
html += '</div>';
@@ -1084,7 +1089,10 @@ class CNNTester {
// Check mode
if (this.vizMode === 'weights' && layerIdx > 0) {
- this.visualizeWeights(layerIdx - 1); // Layer 1 → weights.layers[0]
+ // Map visualization layer to weight array index
+ // Visualization Layer 1 (layerIdx=1) → weights.layers[0] (CNN Layer 1 weights)
+ // Visualization Layer 2 (layerIdx=2) → weights.layers[1] (CNN Layer 2 weights)
+ this.visualizeWeights(layerIdx - 1);
return;
}
@@ -1108,9 +1116,11 @@ class CNNTester {
this.log(`Visualizing ${layerName} activations (${width}×${height})`);
// Update channel labels based on layer type
+ // Static features: 8 channels total (R,G,B,D,UV_X,UV_Y,sin,bias), showing first 4
+ // CNN layers: Up to 8 channels per layer, showing first 4
const channelLabels = layerIdx === 0
- ? ['R', 'G', 'B', 'D'] // Static features: RGBA (R,G,B,Depth,UV_X,UV_Y,sin,bias)
- : ['Ch0', 'Ch1', 'Ch2', 'Ch3']; // CNN layers
+ ? ['Ch0 (R)', 'Ch1 (G)', 'Ch2 (B)', 'Ch3 (D)']
+ : ['Ch0', 'Ch1', 'Ch2', 'Ch3'];
for (let c = 0; c < 4; c++) {
const label = document.getElementById(`channelLabel${c}`);
@@ -1201,14 +1211,17 @@ class CNNTester {
}
visualizeWeights(cnnLayerIdx) {
+ // cnnLayerIdx is index into weights.layers[] array
+ // Display as "Layer N" where N = cnnLayerIdx + 1 (e.g., weights.layers[0] = Layer 1)
const layer = this.weights.layers[cnnLayerIdx];
if (!layer) {
- this.log(`Layer ${cnnLayerIdx} not found`, 'error');
+ this.log(`CNN Layer ${cnnLayerIdx + 1} not found`, 'error');
return;
}
const { kernelSize, inChannels, outChannels, weightOffset, min, max } = layer;
- this.log(`Visualizing Layer ${cnnLayerIdx + 1} weights: ${inChannels}→${outChannels}, ${kernelSize}×${kernelSize}, offset=${weightOffset}`);
+ const displayLayerNum = cnnLayerIdx + 1;
+ this.log(`Visualizing Layer ${displayLayerNum} weights: ${inChannels}→${outChannels}, ${kernelSize}×${kernelSize}, offset=${weightOffset}`);
this.log(`Weight range: [${min.toFixed(3)}, ${max.toFixed(3)}]`);
// Update channel labels to show output channels