-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathProgram.cs
29 lines (26 loc) · 1.03 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
using Microsoft.ML.OnnxRuntime;
using OnnxRuntime.ResNet.Template.utils;
using System;
using System.Collections.Generic;
using System.Linq;
namespace OnnxRuntime.ResNet.Template
{
class Program
{
public static void Main(string[] args)
{
// Read paths
string modelFilePath = @"C:\code\onnxruntime-templates\onnxruntime-csharp-cv-template\model\resnet50v2.onnx";
string imageFilePath = @"C:\code\onnxruntime-templates\onnxruntime-csharp-cv-template\data\dog.jpeg";
var input = ImageHelper.GetImageTensorFromPath(imageFilePath);
var top10 = ModelHelper.GetPredictions(input, modelFilePath);
// Print results to console
Console.WriteLine("Top 10 predictions for ResNet50 v2...");
Console.WriteLine("--------------------------------------------------------------");
foreach (var t in top10)
{
Console.WriteLine($"Label: {t.Label}, Confidence: {t.Confidence}");
}
}
}
}