private void btnBrowse_Click(object sender, RoutedEventArgs e) { var dialog = new OpenFileDialog { Filter = "Image files (*.bmp;*.png;*.jpg;*.jpeg)|*.bmp;*.png;*.jpg;*.jpeg|All files (*.*)|*.*" }; if (dialog.ShowDialog() == true) { var image = new BitmapImage(new Uri(dialog.FileName)); currentInput = MyBitmapTools.GetArray(image); recognize(); } }
private void recognize() { // Assumes currentInput is set correctly // Show input imgInput.Source = MyBitmapTools.GetImageGray8(currentInput); // Feed forward var result = ocrModel.ExecuteSingle(currentInput); txtResult.Text = "Recog: " + result.MostConfident + string.Join("", Enumerable.Range('0', 10).Select(c => Environment.NewLine + (char)c + ": " + result.GetProbability((char)c).ToString("0.0000"))); // Visualize full network var image = NetworkVisualizer.DrawNetworkSingle((ocrModel as NeuralOCRModel).NeuralNetwork, currentInput); imgNetwork.Source = image; }
public SingleResult ExecuteSingle(float[,] input) { float[] output = NeuralNetwork.FeedForward(MyBitmapTools.ReshapeArray(input)); return(new SingleResult(CreateDictFromProbs(output))); }
public LabeledCharacter(char character, float[,] image) { Character = character; Image = image; NetworkInput = MyBitmapTools.ReshapeArray(image); }