Esempio n. 1
0
        static void Main(string[] args)
        {
            ConsoleTraceListener listener = new ConsoleTraceListener();

            Trace.Listeners.Add(listener);

            string ProjPath = Directory.GetParent(System.IO.Directory.GetCurrentDirectory()).Parent.Parent.Parent.FullName;
            string DirPath  = ProjPath + @"\pics_to_recognize\";

            OnnxClassifier clf = new OnnxClassifier(ProjPath + @"\model\resnet50-v2-7.onnx");

            PredictionQueue cq = new PredictionQueue();

            cq.Enqueued += PredictionCaught;
            Task keyBoardTask = Task.Run(() =>
            {
                Trace.WriteLine("*** Press Esc to cancel");
                while (!(Console.KeyAvailable && Console.ReadKey(true).Key == ConsoleKey.Escape))
                {
                }
                clf.StopPrediction();
            });

            clf.PredictAll(cq, new DirectoryInfo(DirPath).GetFiles());

            Trace.Listeners.Remove(listener);
            Trace.Close();
        }
Esempio n. 2
0
 public PredictionController(ILogger <PredictionController> logger)
 {
     _logger  = logger;
     this.dB  = new InMemoryLibrary();
     this.clf = new OnnxClassifier(Directory.GetParent(System.IO.Directory.GetCurrentDirectory()).Parent.Parent.Parent.FullName + @"\model\resnet50-v2-7.onnx");
 }