Exemplo n.º 1
0
        private void Worker()
        {
            string Img_name;
            string th_name = Thread.CurrentThread.Name;
            string _result;
            int    time = 0;

            while (path_Imgs.TryDequeue(out Img_name))
            {
                if (token.IsCancellationRequested)
                {
                    stop++;
                    break;
                }

                _result = th_name + ": " + model.PredictModel(OnnxGeneral.ImageModel(Img_name)) + ", file path: " + Img_name;
                wait_for_write.WaitOne();
                results.Add(_result);
                wait_for_write.Set();
            }
            if (stop == 0)
            {
                Console.WriteLine(th_name + " Stoped normally !");
            }
            else
            {
                Console.WriteLine(th_name + " Stoped by Enter !");
            }
        }
Exemplo n.º 2
0
 public Threadworks(string path, OnnxGeneral onnxModel)
 {
     model = onnxModel;
     _path = path;
 }