From fb13e67acbc7d7dd2974a456fcb134966c47cee0 Mon Sep 17 00:00:00 2001 From: skal Date: Fri, 27 Mar 2026 07:59:00 +0100 Subject: fix(cnn_v3): remove dec0 ReLU, load FiLM MLP at runtime MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two bugs blocking training convergence: 1. dec0 ReLU before sigmoid constrained output to [0.5,1.0] — network could never produce dark pixels. Removed F.relu in train_cnn_v3.py and max(0,…) in cnn_v3_dec0.wgsl. Test vectors regenerated. 2. set_film_params() used hardcoded heuristics instead of the trained MLP. Added CNNv3FilmMlp struct + load_film_mlp() to cnn_v3_effect.h/.cc. MLP auto-loaded from ASSET_WEIGHTS_CNN_V3_FILM_MLP at construction; Linear(5→16)→ReLU→Linear(16→72) runs CPU-side each frame. 36/36 tests pass. Parity max_err=4.88e-4 unchanged. handoff(Gemini): retrain from scratch — needs ≥50 samples (currently 11). See cnn_v3/docs/HOWTO.md §2-3. --- cnn_v3/shaders/cnn_v3_dec0.wgsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cnn_v3/shaders/cnn_v3_dec0.wgsl') diff --git a/cnn_v3/shaders/cnn_v3_dec0.wgsl b/cnn_v3/shaders/cnn_v3_dec0.wgsl index 617b5a2..79fd837 100644 --- a/cnn_v3/shaders/cnn_v3_dec0.wgsl +++ b/cnn_v3/shaders/cnn_v3_dec0.wgsl @@ -64,7 +64,7 @@ fn dec0_main(@builtin(global_invocation_id) id: vec3u) { } } } - let v = max(0.0, params.gamma[o] * sum + params.beta[o]); + let v = params.gamma[o] * sum + params.beta[o]; out[o] = 1.0 / (1.0 + exp(-v)); } -- cgit v1.2.3