summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-13 12:44:58 +0100
committerskal <pascal.massimino@gmail.com>2026-02-13 12:44:58 +0100
commit32d36c7b690c9d72c12269f9acf306a45860964a (patch)
treec97a89eecb1c49fc1eab62792543a109a0c69262
parent5a17ed664edc5a66d3b43d3596c389ab58a4ec19 (diff)
Fix train_cnn_v2_full.sh for updated API
Changes: - KERNEL_SIZES: Use comma-separated values (3,3,3 not 3 3 3) - Remove --channels (no longer exists in uniform 12D→4D architecture) - Add --num-layers parameter - Use export_cnn_v2_weights.py (storage buffer) instead of export_cnn_v2_shader.py - Fix duplicate export: only export in step 2 (training) or validation mode Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
-rwxr-xr-xscripts/train_cnn_v2_full.sh16
1 files changed, 8 insertions, 8 deletions
diff --git a/scripts/train_cnn_v2_full.sh b/scripts/train_cnn_v2_full.sh
index db55a8b..5a4e55e 100755
--- a/scripts/train_cnn_v2_full.sh
+++ b/scripts/train_cnn_v2_full.sh
@@ -53,8 +53,8 @@ DETECTOR="harris"
# FULL_IMAGE="--full-image"
# IMAGE_SIZE=256
-KERNEL_SIZES="3 3 3"
-CHANNELS="8 4 4"
+KERNEL_SIZES="3,3,3" # Comma-separated per-layer kernel sizes
+NUM_LAYERS=3
if [ "$VALIDATE_ONLY" = true ]; then
echo "=== CNN v2 Validation Only ==="
@@ -79,7 +79,7 @@ python3 training/train_cnn_v2.py \
--patches-per-image $PATCHES_PER_IMAGE \
--detector $DETECTOR \
--kernel-sizes $KERNEL_SIZES \
- --channels $CHANNELS \
+ --num-layers $NUM_LAYERS \
--epochs $EPOCHS \
--batch-size $BATCH_SIZE \
--checkpoint-dir "$CHECKPOINT_DIR" \
@@ -103,10 +103,10 @@ if [ ! -f "$FINAL_CHECKPOINT" ]; then
FINAL_CHECKPOINT=$(ls -t "$CHECKPOINT_DIR"/checkpoint_epoch_*.pth | head -1)
fi
-echo "[2/4] Exporting final checkpoint to WGSL shaders..."
+echo "[2/4] Exporting final checkpoint to binary weights..."
echo "Checkpoint: $FINAL_CHECKPOINT"
-python3 training/export_cnn_v2_shader.py "$FINAL_CHECKPOINT" \
- --output-dir workspaces/main/shaders
+python3 training/export_cnn_v2_weights.py "$FINAL_CHECKPOINT" \
+ --output-weights workspaces/main/weights/cnn_v2_weights.bin
if [ $? -ne 0 ]; then
echo "Error: Shader export failed"
@@ -152,8 +152,8 @@ fi
mkdir -p "$VALIDATION_DIR"
echo " Using checkpoint: $FINAL_CHECKPOINT"
-# Export weights only if not in validate mode
-if [ "$VALIDATE_ONLY" = false ]; then
+# Export weights for validation mode (already exported in step 2 for training mode)
+if [ "$VALIDATE_ONLY" = true ]; then
python3 training/export_cnn_v2_weights.py "$FINAL_CHECKPOINT" \
--output-weights workspaces/main/weights/cnn_v2_weights.bin > /dev/null 2>&1
fi