public async Task <MpsnnGraphModelOutput> EvaluateAsync(MpsnnGraphModelInput input)
        {
            MpsnnGraphModelOutput       output  = new MpsnnGraphModelOutput();
            LearningModelBindingPreview binding = new LearningModelBindingPreview(_learningModel);

            binding.Bind("image", input.Image);
            binding.Bind("grid", output.Grid);
            LearningModelEvaluationResultPreview evalResult = await _learningModel.EvaluateAsync(binding, string.Empty);

            return(output);
        }
Exemple #2
0
        private async void CameraHelper_FrameArrived(object sender, Microsoft.Toolkit.Uwp.Helpers.FrameEventArgs e)
        {
            if (e?.VideoFrame?.SoftwareBitmap == null)
            {
                return;
            }

            //var input = new TinyYoloV2ModelInput { Image = e.VideoFrame };
            var input = new MpsnnGraphModelInput {
                Image = e.VideoFrame
            };

            _stopwatch = Stopwatch.StartNew();
            var output = await _model.EvaluateAsync(input);

            _stopwatch.Stop();
            _boxes = _parser.ParseOutputs(output.Grid.ToArray());

            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() =>
            {
                TextBlockInformation.Text = $"{1000f / _stopwatch.ElapsedMilliseconds,4:f1} fps on Width {_yoloCanvasActualWidth} x Height {_yoloCanvasActualHeight}";
                DrawOverlays(e.VideoFrame);
            });
        }