forked from StrafesNET/strafe-ai
hardcode depth "normalization"
This commit is contained in:
17
src/main.rs
17
src/main.rs
@@ -194,7 +194,7 @@ impl GraphicsState {
|
||||
self.texture_data[(STRIDE_SIZE * y) as usize
|
||||
..(STRIDE_SIZE * y + SIZE.x * size_of::<f32>() as u32) as usize]
|
||||
.chunks_exact(4)
|
||||
.map(|b| f32::from_le_bytes(b.try_into().unwrap())),
|
||||
.map(|b| 1.0 - 2.0 * f32::from_le_bytes(b.try_into().unwrap())),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -326,21 +326,6 @@ fn training() {
|
||||
g.generate_inputs(pos, angles, &mut inputs);
|
||||
}
|
||||
|
||||
// normalize inputs
|
||||
let global_min = *inputs
|
||||
.iter()
|
||||
.min_by(|a, b| a.partial_cmp(b).unwrap())
|
||||
.unwrap();
|
||||
let global_max = *inputs
|
||||
.iter()
|
||||
.max_by(|a, b| a.partial_cmp(b).unwrap())
|
||||
.unwrap();
|
||||
let global_range = global_max - global_min;
|
||||
println!("Normalizing to range {global_min} - {global_max}");
|
||||
inputs.iter_mut().for_each(|value| {
|
||||
*value = 1.0 - (*value - global_min) / global_range;
|
||||
});
|
||||
|
||||
let device = burn::backend::cuda::CudaDevice::new(gpu_id);
|
||||
|
||||
let mut model: Net<TrainingBackend> = Net::init(&device);
|
||||
|
||||
Reference in New Issue
Block a user