Example #1
0
        public async Task <TinyYoloV2ModelOutput> EvaluateAsync(TinyYoloV2ModelInput input)
        {
            var output  = new TinyYoloV2ModelOutput();
            var binding = new LearningModelBindingPreview(_learningModel);

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

            return(output);
        }
Example #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
            };

            _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);
            });
        }