Exemplo n.º 1
0
        public async Task <modelOutput> EvaluateAsync(modelInput input)
        {
            binding.Bind("data", input.data);
            var result = await session.EvaluateAsync(binding, "0");

            var output = new modelOutput();

            output.model_outputs0 = result.Outputs["model_outputs0"] as TensorFloat;
            return(output);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Detect objects from the given image.
        /// The input image must be 416x416.
        /// </summary>
        public async Task <IList <PredictionModel> > PredictImageAsync(VideoFrame image)
        {
            var output       = new modelOutput();
            var imageFeature = ImageFeatureValue.CreateFromVideoFrame(image);
            var bindings     = new LearningModelBinding(Session);

            bindings.Bind("data", imageFeature);
            bindings.Bind("model_outputs0", output.Model_outputs0);
            var result = await Session.EvaluateAsync(bindings, "0");

            return(Postprocess(output.Model_outputs0));
        }