private static void Run() { inception = new Emgu.TF.Lite.Models.Inception(); inception.OnDownloadProgressChanged += onDownloadProgressChanged; inception.OnDownloadCompleted += onDownloadCompleted; System.Console.WriteLine("Initializing inception"); inception.Init(); }
static async Task Main(string[] args) { #if DEBUG ConsoleTraceListener consoleTraceListener = new ConsoleTraceListener(); Trace.Listeners.Add(consoleTraceListener); #endif TfLiteInvoke.CheckLibraryLoaded(); String fileName = Path.Join(AssemblyDirectory, "tulips.jpg"); if (args.Length > 0) { fileName = args[0]; } _inputFileInfo = new FileInfo(fileName); if (!_inputFileInfo.Exists) { System.Console.WriteLine(String.Format("File '{0}' does not exist. Please provide a valid file name as input parameter.", _inputFileInfo.FullName)); return; } Trace.WriteLine(String.Format("Working on file {0}", _inputFileInfo.FullName)); inception = new Emgu.TF.Lite.Models.Inception(); inception.OnDownloadProgressChanged += onDownloadProgressChanged; System.Console.WriteLine("Initializing inception"); await inception.Init(); Stopwatch watch = Stopwatch.StartNew(); var result = inception.Recognize(_inputFileInfo.FullName); watch.Stop(); String resStr = String.Format("Object is {0} with {1}% probability. Recognition completed in {2} milliseconds.", result[0].Label, result[0].Probability * 100, watch.ElapsedMilliseconds); System.Console.WriteLine(resStr); System.Console.WriteLine("Press any key to continue:"); System.Console.ReadKey(); }