private async void SettingsPage_Loaded(object sender, RoutedEventArgs e) { trainSetConfig = await TrainSetConfigHelper.ParseConfigJson(); imageProcessor = new ImageProcessor(); perceptron = new Perceptron(); symbol1TextBlock.Text = trainSetConfig.Train1.Symbol; symbol2TextBlock.Text = trainSetConfig.Train2.Symbol; }
private async void InitFields(bool loadModel) { trainSetConfig = await TrainSetConfigHelper.ParseConfigJson(); imageProcessor = new ImageProcessor(); rowCellsCount = trainSetConfig.ImageWidth; columnCellCount = trainSetConfig.ImageHeight; cellsCount = rowCellsCount * columnCellCount; cells = new int[cellsCount]; weights = new double[cellsCount + 1]; if (loadModel) { await LoadModel(); } else { GenerateInitWeightVector(); } }
public async static Task <TrainSetConfig> ParseConfigJson() { var file = await StorageFile.GetFileFromApplicationUriAsync(new Uri(@"ms-appx:///Configs/TrainingSetConfig.json")); JObject json = JObject.Parse(File.ReadAllText(file.Path)); var config = new TrainSetConfig { ImageHeight = json.Value <int>("imageH"), ImageWidth = json.Value <int>("imageW"), Train1 = new TrainConfig { Symbol = json["train1"].Value <string>("symbol"), Value = json["train1"].Value <int>("value") }, Train2 = new TrainConfig { Symbol = json["train2"].Value <string>("symbol"), Value = json["train2"].Value <int>("value") }, }; return(config); }
private async void InitConfig() { trainSetConfig = await TrainSetConfigHelper.ParseConfigJson(); }