forked from dotnet/machinelearning-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
45 lines (36 loc) · 1.27 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
30
31
32
33
34
35
36
37
38
39
40
41
42
using System;
using System.IO;
using System.IO.Compression;
using System.Net;
namespace ObjectDetection
{
class Program
{
public static void Main()
{
var assetsRelativePath = @"../../../assets";
string assetsPath = GetAbsolutePath(assetsRelativePath);
var modelFilePath = Path.Combine(assetsPath, "Model", "TinyYolo2_model.onnx");
var imagesFolder = Path.Combine(assetsPath,"images");
var tagsTsv = Path.Combine(assetsPath,"images", "tags.tsv");
try
{
var modelScorer = new OnnxModelScorer(tagsTsv, imagesFolder, modelFilePath);
modelScorer.Score();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
Console.WriteLine("========= End of Process..Hit any Key ========");
Console.ReadLine();
}
public static string GetAbsolutePath(string relativePath)
{
FileInfo _dataRoot = new FileInfo(typeof(Program).Assembly.Location);
string assemblyFolderPath = _dataRoot.Directory.FullName;
string fullPath = Path.Combine(assemblyFolderPath, relativePath);
return fullPath;
}
}
}