forked from dotnet/machinelearning-samples
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathProgram.vb
35 lines (27 loc) · 1.41 KB
/
Program.vb
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
Imports System.IO
Imports ImageClassification.Model
Imports ImageClassification.Model.ConsoleHelpers
Namespace ImageClassification.Predict
Friend Class Program
Shared Sub Main(args() As String)
Dim assetsRelativePath As String = "../../../assets"
Dim assetsPath As String = GetAbsolutePath(assetsRelativePath)
Dim imagesFolder = Path.Combine(assetsPath, "inputs", "images-for-predictions")
Dim imageClassifierZip = Path.Combine(assetsPath, "inputs", "MLNETModel", "imageClassifier.zip")
Try
'INSTANT VB NOTE: The variable modelScorer was renamed since it may cause conflicts with calls to static members of the user-defined type with this name:
Dim modelScorer_Renamed = New ModelScorer(imagesFolder, imageClassifierZip)
modelScorer_Renamed.ClassifyImages()
Catch ex As Exception
ConsoleWriteException(ex.ToString())
End Try
ConsolePressAnyKey()
End Sub
Public Shared Function GetAbsolutePath(relativePath As String) As String
Dim _dataRoot As New FileInfo(GetType(Program).Assembly.Location)
Dim assemblyFolderPath As String = _dataRoot.Directory.FullName
Dim fullPath As String = Path.Combine(assemblyFolderPath, relativePath)
Return fullPath
End Function
End Class
End Namespace