Example #1
0
        /// <summary>
        /// Evaluate the model
        /// </summary>
        /// <param name="input">The VideoFrame to evaluate</param>
        /// <returns></returns>
        public async Task <ONNXModelOutput> EvaluateAsync(ONNXModelInput input)
        {
            var output  = new ONNXModelOutput();
            var binding = new LearningModelBinding(_session);

            binding.Bind("data", input.data);
            binding.Bind("classLabel", output.classLabel);
            binding.Bind("loss", output.loss);
            LearningModelEvaluationResult result = await _session.EvaluateAsync(binding, "0");

            return(output);
        }
        async Task ProcessOutputAsync(ONNXModelOutput evalOutput)
        {
            // Get the label and loss from the output
            loss  = (evalOutput.loss[0]["AnSungEmpty"] * 100.0f).ToString("#0.00");
            loss2 = (evalOutput.loss[0]["ChamGgeEmpty"] * 100.0f).ToString("#0.00");
            loss3 = (evalOutput.loss[0]["MiYuckGukEmpty"] * 100.0f).ToString("#0.00");
            loss4 = (evalOutput.loss[0]["ShinRaMyunEmpty"] * 100.0f).ToString("#0.00");
            loss5 = (evalOutput.loss[0]["AllSet"] * 100.0f).ToString("#0.00");

            // Display the score
            await this.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
                                           () =>
            {
                scoreTB.Text = "An Sung Tang Myun Empty" + "\n   " + loss + "%"
                               + "\nCham Gge Ra Myun Empty" + "\n   " + loss2 + "%"
                               + "\nMi Yuck Guk Ra Myun Empty" + "\n   " + loss3 + "%"
                               + "\nShin Ra Myun Empty" + "\n   " + loss4 + "%"
                               + "\n\n All Ra Myuns are set" + "\n   " + loss5 + "%";
            }
                                           );
        }