|
1 | | -use std::process::exit; |
2 | 1 | use crate::data_sets::TestSet; |
3 | 2 | use crate::matrix::Matrix; |
4 | 3 | use image::RgbImage; |
| 4 | +use std::process::exit; |
5 | 5 |
|
6 | 6 | extern crate image; |
7 | 7 |
|
| 8 | +use crate::neural_network::{NNConfig, NeuralNetwork}; |
8 | 9 | use image::{ImageBuffer, Rgb}; |
9 | 10 | use lz4_compression::decompress::decompress; |
10 | 11 | use serde::{Deserialize, Serialize}; |
11 | | -use crate::neural_network::{NeuralNetwork, NNConfig}; |
12 | 12 |
|
13 | 13 | #[derive(Deserialize, Serialize, Debug)] |
14 | 14 | pub struct MNist { |
@@ -105,7 +105,8 @@ impl MNist { |
105 | 105 | let value = matrix.get((i * 28 + j) as usize, 0); |
106 | 106 | let value = (value * 255.0) as u8; |
107 | 107 | // add col and row to the i j variable |
108 | | - *image.get_pixel_mut(i + col * 28, j + row * 28) = Rgb([value, value, value]); |
| 108 | + *image.get_pixel_mut(i + col * 28, j + row * 28) = |
| 109 | + Rgb([value, value, value]); |
109 | 110 | } |
110 | 111 | } |
111 | 112 | } |
@@ -154,6 +155,11 @@ impl MNist { |
154 | 155 | nn.command_sender = config.command_sender; |
155 | 156 | nn.update_interval = config.update_interval; |
156 | 157 | // todo: dont clone |
157 | | - nn.train_epochs_m(self.train_input.clone(), self.train_target.clone(), config.batch_number, config.epochs); |
| 158 | + nn.train_epochs_m( |
| 159 | + self.train_input.clone(), |
| 160 | + self.train_target.clone(), |
| 161 | + config.batch_number, |
| 162 | + config.epochs, |
| 163 | + ); |
158 | 164 | } |
159 | 165 | } |
0 commit comments