summaryrefslogtreecommitdiff
path: root/workspaces/main
diff options
context:
space:
mode:
Diffstat (limited to 'workspaces/main')
-rw-r--r--workspaces/main/shaders/cnn_v2/cnn_v2_compute.wgsl7
-rw-r--r--workspaces/main/shaders/cnn_v2/cnn_v2_static.wgsl8
-rw-r--r--workspaces/main/weights/mix.binbin0 -> 136 bytes
-rw-r--r--workspaces/main/weights/mix_p47.binbin0 -> 136 bytes
4 files changed, 9 insertions, 6 deletions
diff --git a/workspaces/main/shaders/cnn_v2/cnn_v2_compute.wgsl b/workspaces/main/shaders/cnn_v2/cnn_v2_compute.wgsl
index 6905e75..cdbfd74 100644
--- a/workspaces/main/shaders/cnn_v2/cnn_v2_compute.wgsl
+++ b/workspaces/main/shaders/cnn_v2/cnn_v2_compute.wgsl
@@ -11,6 +11,7 @@ struct LayerParams {
weight_offset: u32, // Offset in f16 units
is_output_layer: u32, // 1 if final layer (sigmoid), 0 otherwise (relu)
blend_amount: f32, // [0,1] blend with original
+ is_layer_0: u32, // 1 if first layer (clamp [0,1]), 0 otherwise
}
@group(0) @binding(0) var static_features: texture_2d<u32>; // 8D static features (p0-p3 + spatial)
@@ -120,9 +121,9 @@ fn main(@builtin(global_invocation_id) id: vec3<u32>) {
}
}
- // Activation
- if (is_output) {
- output[c] = clamp(sum, 0.0, 1.0);
+ // Activation (matches train_cnn_v2.py)
+ if (is_output || params.is_layer_0 != 0u) {
+ output[c] = 1.0 / (1.0 + exp(-sum)); // Sigmoid [0,1]
} else {
output[c] = max(0.0, sum); // ReLU
}
diff --git a/workspaces/main/shaders/cnn_v2/cnn_v2_static.wgsl b/workspaces/main/shaders/cnn_v2/cnn_v2_static.wgsl
index 7039d96..7b08132 100644
--- a/workspaces/main/shaders/cnn_v2/cnn_v2_static.wgsl
+++ b/workspaces/main/shaders/cnn_v2/cnn_v2_static.wgsl
@@ -9,7 +9,9 @@
struct StaticFeatureParams {
mip_level: u32,
- padding: vec3<u32>,
+ padding0: u32,
+ padding1: u32,
+ padding2: u32,
}
@group(0) @binding(0) var input_tex: texture_2d<f32>;
@@ -46,9 +48,9 @@ fn main(@builtin(global_invocation_id) id: vec3<u32>) {
let p2 = rgba.b;
let p3 = textureLoad(depth_tex, coord, 0).r;
- // UV coordinates (normalized [0,1], bottom-left origin)
+ // UV coordinates (normalized [0,1], top-left origin - matches training)
let uv_x = f32(coord.x) / f32(dims.x);
- let uv_y = 1.0 - (f32(coord.y) / f32(dims.y));
+ let uv_y = f32(coord.y) / f32(dims.y);
// Multi-frequency position encoding
let sin20_y = sin(20.0 * uv_y);
diff --git a/workspaces/main/weights/mix.bin b/workspaces/main/weights/mix.bin
new file mode 100644
index 0000000..358c12f
--- /dev/null
+++ b/workspaces/main/weights/mix.bin
Binary files differ
diff --git a/workspaces/main/weights/mix_p47.bin b/workspaces/main/weights/mix_p47.bin
new file mode 100644
index 0000000..c16e50f
--- /dev/null
+++ b/workspaces/main/weights/mix_p47.bin
Binary files differ