Exemple #1
0
 // public ConcurrentQueue<LabeledImage> QueueForLabeledImages;
 public NNP(string model_name, ProcessResultDelegate processResult, int width = 28, int height = 28)
 {
     logProcAmount      = Environment.ProcessorCount;
     thread_arr         = new Thread[logProcAmount];
     waiter             = new AutoResetEvent(true);
     cts                = new CancellationTokenSource();
     this.processResult = processResult;
     finishedProcessing = false;
     IsProcessing       = false;
     this.model_name    = model_name;
     wasTerminated      = false;
     _converter         = new ByteImageSharpConverter(width, height);
 }
        /// <summary>
        /// Init depth-first search.
        /// </summary>
        /// <param name="context">Custom data to be passed to delegates.</param>
        /// <param name="getChildren">Delegate to obtain children for current branch.</param>
        /// <param name="processResult">Delegate to process result.</param>
        /// <param name="maxDepth">Depth limit (negative is treated as no limit).</param>
        public void Init(object context, GetChildrenDelegate <T> getChildren, ProcessResultDelegate <T> processResult, int maxDepth = -1)
        {
            if (getChildren == null)
            {
                throw new ArgumentNullException("getChildren");
            }
            if (processResult == null)
            {
                throw new ArgumentNullException("processResult");
            }

            this.context       = context;
            this.getChildren   = getChildren;
            this.processResult = processResult;
            this.maxDepth      = maxDepth;
            branch             = new List <T>();
        }