Esempio n. 1
0
        public async Task <mnistOutput> EvaluateAsync(mnistInput input)
        {
            binding.Bind("Input3", input.Input3);
            var result = await session.EvaluateAsync(binding, "0");

            var output = new mnistOutput();

            output.Plus214_Output_0 = result.Outputs["Plus214_Output_0"] as TensorFloat;
            return(output);
        }
Esempio n. 2
0
        private async void recognizeButton_Click(object sender, RoutedEventArgs e)
        {
            //Bind model input with contents from InkCanvas
            VideoFrame vf = await helper.GetHandWrittenImage(inkGrid);

            mnistInput.Input3 = ImageFeatureValue.CreateFromVideoFrame(vf);
            //Evaluate the model
            mnistOutput = await modelGen.EvaluateAsync(mnistInput);

            //Convert output to datatype
            IReadOnlyList <float> VectorImage = mnistOutput.Plus214_Output_0.GetAsVectorView();
            IList <float>         ImageList   = VectorImage.ToList();

            //LINQ query to check for highest probability digit
            var maxIndex = ImageList.IndexOf(ImageList.Max());

            //Display the results
            numberLabel.Text = maxIndex.ToString();
        }