summaryrefslogtreecommitdiff
path: root/doc/HOWTO.md
diff options
context:
space:
mode:
Diffstat (limited to 'doc/HOWTO.md')
-rw-r--r--doc/HOWTO.md58
1 files changed, 58 insertions, 0 deletions
diff --git a/doc/HOWTO.md b/doc/HOWTO.md
index d02fdb4..1ae1d94 100644
--- a/doc/HOWTO.md
+++ b/doc/HOWTO.md
@@ -130,6 +130,64 @@ Processes entire image with sliding window (matches WGSL):
**Kernel sizes:** 3×3 (36 weights), 5×5 (100 weights), 7×7 (196 weights)
+### CNN v2 Training
+
+Enhanced CNN with parametric static features (7D input: RGBD + UV + sin encoding + bias).
+
+**Complete Pipeline** (recommended):
+```bash
+# Train → Export → Build → Validate
+./scripts/train_cnn_v2_full.sh
+```
+
+Config: 100 epochs, 3×3 kernels, 8→4→4 channels, patch-based (harris detector).
+- Live progress with single-line update
+- Validates all input images on final epoch
+- Exports binary weights (storage buffer architecture)
+
+**Validation Only** (skip training):
+```bash
+# Use latest checkpoint
+./scripts/train_cnn_v2_full.sh --validate
+
+# Use specific checkpoint
+./scripts/train_cnn_v2_full.sh --validate checkpoints/checkpoint_epoch_50.pth
+```
+
+**Manual Training:**
+```bash
+# Default config
+./training/train_cnn_v2.py \
+ --input training/input/ --target training/target_2/ \
+ --epochs 100 --batch-size 16 --checkpoint-every 5
+
+# Custom architecture
+./training/train_cnn_v2.py \
+ --input training/input/ --target training/target_2/ \
+ --kernel-sizes 1 3 5 --channels 16 8 4 \
+ --epochs 5000 --batch-size 16
+```
+
+**Export Binary Weights:**
+```bash
+./training/export_cnn_v2_weights.py checkpoints/checkpoint_epoch_100.pth \
+ --output-weights workspaces/main/cnn_v2_weights.bin
+```
+
+Generates binary format: header + layer info + f16 weights (~3.2 KB for 3-layer model).
+Storage buffer architecture allows dynamic layer count.
+
+**TODO:** 8-bit quantization for 2× size reduction (~1.6 KB). Requires quantization-aware training (QAT).
+
+# Options:
+# -i DIR Test images directory (default: training/validation)
+# -o DIR Output directory (default: validation_results)
+# --skip-build Use existing cnn_test binary
+# -h Show all options
+```
+
+See `scripts/validate_cnn_v2.sh --help` for full usage. See `doc/CNN_V2.md` for design details.
+
---
## Timeline