forked from dotnet/machinelearning-samples
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathProgram.cs
43 lines (35 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
43
using System;
using System.IO;
using System.Threading.Tasks;
using ImageClassification.Model;
using static ImageClassification.Model.ConsoleHelpers;
namespace ImageClassification.Predict
{
class Program
{
static void Main(string[] args)
{
string assetsRelativePath = @"../../../assets";
string assetsPath = GetAbsolutePath(assetsRelativePath);
var imagesFolder = Path.Combine(assetsPath, "inputs", "images-for-predictions");
var imageClassifierZip = Path.Combine(assetsPath, "inputs", "MLNETModel", "imageClassifier.zip");
try
{
var modelScorer = new ModelScorer(imagesFolder, imageClassifierZip);
modelScorer.ClassifyImages();
}
catch (Exception ex)
{
ConsoleWriteException(ex.ToString());
}
ConsolePressAnyKey();
}
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;
}
}
}