예제 #1
0
 static TfLiteInvokeIOS()
 {
     _libraryLoaded = TfLiteInvoke.CheckLibraryLoaded();
     if (_libraryLoaded)
     {
         TfLiteInvoke.RedirectError(TfLiteInvokeIOS.TfliteErrorHandlerThrowException);
     }
 }
예제 #2
0
파일: MainForm.cs 프로젝트: huangyhg/emgutf
        public MainForm()
        {
            InitializeComponent();

            TfLiteInvoke.CheckLibraryLoaded();
            messageLabel.Text = String.Empty;
            cameraButton.Text = _startCameraText;

            _mobileNet = new CocoSsdMobilenetV3();
            _mobileNet.OnDownloadProgressChanged += OnDownloadProgressChangedEventHandler;
        }
예제 #3
0
파일: Program.cs 프로젝트: huangyhg/emgutf
        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();
        }