예제 #1
0
        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();
            }
        }
예제 #2
0
        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;
        }
예제 #3
0
 public SingleResult ExecuteSingle(float[,] input)
 {
     float[] output = NeuralNetwork.FeedForward(MyBitmapTools.ReshapeArray(input));
     return(new SingleResult(CreateDictFromProbs(output)));
 }
예제 #4
0
 public LabeledCharacter(char character, float[,] image)
 {
     Character    = character;
     Image        = image;
     NetworkInput = MyBitmapTools.ReshapeArray(image);
 }