Exemplo n.º 1
0
        public async Task <CatOrDogModelOutput> EvaluateAsync(CatOrDogModelInput input)
        {
            CatOrDogModelOutput         output  = new CatOrDogModelOutput();
            LearningModelBindingPreview binding = new LearningModelBindingPreview(learningModel);

            binding.Bind("data", input.data);
            binding.Bind("classLabel", output.classLabel);
            binding.Bind("loss", output.loss);
            LearningModelEvaluationResultPreview evalResult = await learningModel.EvaluateAsync(binding, string.Empty);

            return(output);
        }
Exemplo n.º 2
0
        private async Task GetPredictionFromImage()
        {
            var storageFile = await GetFileForClassification();

            var softwareBitmap = await ConvertToSoftwareBitmap(storageFile);

            await ShowImage(softwareBitmap);

            var videoFrame = ConvertToVideoFrame(softwareBitmap);
            var input      = new CatOrDogModelInput
            {
                data = videoFrame
            };
            var output = await _model.EvaluateAsync(input);

            ShowPredictionResult(output);
        }