Пример #1
0
 static TfLiteInvokeIOS()
 {
     _libraryLoaded = TfLiteInvoke.CheckLibraryLoaded();
     if (_libraryLoaded)
     {
         TfLiteInvoke.RedirectError(TfLiteInvokeIOS.TfliteErrorHandlerThrowException);
     }
 }
Пример #2
0
        public MainForm()
        {
            InitializeComponent();

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

            _mobileNet = new CocoSsdMobilenetV3();
            _mobileNet.OnDownloadProgressChanged += OnDownloadProgressChangedEventHandler;
        }
Пример #3
0
        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();
        }