From 91d42f2d057e077c267d6775cc109a801aa315c0 Mon Sep 17 00:00:00 2001 From: skal Date: Thu, 12 Feb 2026 11:34:50 +0100 Subject: CNN v2: parametric static features - Phases 1-4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Infrastructure for enhanced CNN post-processing with 7D feature input. Phase 1: Shaders - Static features compute (RGBD + UV + sin10_x + bias → 8×f16) - Layer template (convolution skeleton, packing/unpacking) - 3 mip level support for multi-scale features Phase 2: C++ Effect - CNNv2Effect class (multi-pass architecture) - Texture management (static features, layer buffers) - Build integration (CMakeLists, assets, tests) Phase 3: Training Pipeline - train_cnn_v2.py: PyTorch model with static feature concatenation - export_cnn_v2_shader.py: f32→f16 quantization, WGSL generation - Configurable architecture (kernels, channels) Phase 4: Validation - validate_cnn_v2.sh: End-to-end pipeline - Checkpoint → shaders → build → test images Tests: 36/36 passing Next: Complete render pipeline implementation (bind groups, multi-pass) Co-Authored-By: Claude Sonnet 4.5 --- doc/HOWTO.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'doc') diff --git a/doc/HOWTO.md b/doc/HOWTO.md index 2b896ab..7be5246 100644 --- a/doc/HOWTO.md +++ b/doc/HOWTO.md @@ -130,6 +130,32 @@ 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): + +```bash +# Train CNN v2 with default config (1×1, 3×3, 5×5 kernels, 16→8→4 channels) +./training/train_cnn_v2.py \ + --input training/input/ --target training/output/ \ + --epochs 5000 --batch-size 16 \ + --checkpoint-every 1000 + +# Custom architecture (smaller for size optimization) +./training/train_cnn_v2.py \ + --input training/input/ --target training/output/ \ + --kernel-sizes 1 3 3 --channels 8 4 4 \ + --epochs 5000 --batch-size 16 +``` + +**Export shaders:** +```bash +./training/export_cnn_v2_shader.py checkpoints/checkpoint_epoch_5000.pth \ + --output-dir workspaces/main/shaders +``` + +Generates `cnn_v2_layer_0.wgsl`, `cnn_v2_layer_1.wgsl`, `cnn_v2_layer_2.wgsl` with f16 weights. + ### CNN v2 Validation End-to-end testing: checkpoint → shaders → build → test images → results -- cgit v1.2.3