This commit is contained in:
2026-03-26 13:48:43 -07:00
parent 5902f4fb1b
commit 77fcb52731

View File

@@ -321,14 +321,17 @@ fn training() {
)
}
let input_slice = &inputs[i * INPUT..(i + 1) * INPUT];
let u8_slice = unsafe {
core::slice::from_raw_parts(input_slice.as_ptr().cast(), INPUT * size_of::<f32>())
};
fn sigmoid(x: f32) -> f32 {
1.0 / (1.0 + (-x).exp())
}
// write a png
output_image_native(
u8_slice,
&inputs[i * INPUT..(i + 1) * INPUT]
.iter()
.copied()
.map(|f| (sigmoid(f / 32.0) * 255.0) as u8)
.collect::<Vec<u8>>(),
(SIZE_X, SIZE_Y),
format!("depth_images/{i}.png").into(),
);