Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
CVOnnxObjectDetectionChanges.cs
public sealed class modelOutput
{
public TensorFloat Model_outputs0 = TensorFloat.Create(new long[] { 1, 4 });
}
...
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);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment