예제 #1
0
        private RawIdentifyResults IdentifyFaces()
        {
            RawIdentifyResults   rawIdentifyResults = new RawIdentifyResults();
            List <CompareResult> list = new List <CompareResult>();
            FrameInfo            result;

            while (this._frames.TryDequeue(out result))
            {
                try
                {
                    CompareResult[] recommendedList = this._engineWorker.GetRecommendedList(result);
                    if (recommendedList.Length == 0)
                    {
                        if (this._device.SaveUnidentified)
                        {
                            rawIdentifyResults.LastUnKnown = result;
                        }
                    }
                    else
                    {
                        list.AddRange((IEnumerable <CompareResult>)recommendedList);
                        result.Device.IdentifierCount += recommendedList.Length;
                    }
                }
                catch (Exception ex)
                {
                    this._logger.Error((object)" IdentifyFaces Error ", ex);
                    ++result.Device.VerificationErrors;
                }
            }
            rawIdentifyResults.Known = CompareRequest.GroupKnown((IEnumerable <CompareResult>)list);
            return(rawIdentifyResults);
        }
예제 #2
0
 private void Save(RawIdentifyResults results)
 {
     this.SaveResults((IEnumerable <CompareResult>)results.Known);
     if (!this._device.SaveUnidentified || results.UnKnownCount < Settings.Default.MinFaceCount)
     {
         return;
     }
     this.SaveLog(CompareRequest.FrameToLogBcLog(results.LastUnKnown));
 }
예제 #3
0
 public static void WorkerThread()
 {
     while (!IdentificationServer.StopFlag)
     {
         IdentificationServer.ClearCompletedTasks();
         if (!IdentificationServer.IsLoaded)
         {
             Thread.Sleep(100);
         }
         else if (IdentificationServer.Requests.IsEmpty)
         {
             Thread.Sleep(100);
         }
         else
         {
             int       trackingPeriod = IdentificationServer.SetGetServerSettings(false).TrackingPeriod * 1000;
             FrameInfo result;
             while (!IdentificationServer.StopFlag && IdentificationServer.Requests.TryDequeue(out result))
             {
                 try
                 {
                     FrameInfo frame = result;
                     IdentificationServer.ClearCompletedTasks();
                     bool flag = false;
                     foreach (CompareRequest compareRequest in Enumerable.Where <CompareRequest>((IEnumerable <CompareRequest>)IdentificationServer.CommonRequests, (Func <CompareRequest, bool>)(request => request.DeviceId == frame.Device.Id && request.RequestStatus == RequestStatus.Wait)))
                     {
                         if (compareRequest.HasSimilar(Settings.Default.MinScore, frame) && compareRequest.RequestStatus == RequestStatus.Wait)
                         {
                             compareRequest.Add(frame);
                             flag = true;
                         }
                     }
                     if (!flag)
                     {
                         CompareRequest compareRequest = new CompareRequest(frame.Device, IdentificationServer.Logger, IdentificationServer.EngineWorker);
                         compareRequest.Add(frame);
                         compareRequest.ProcessAfter(trackingPeriod);
                         IdentificationServer.CommonRequests.Add(compareRequest);
                     }
                 }
                 catch (Exception ex)
                 {
                     IdentificationServer.Logger.Error((object)"WorkerThread Errror - ", ex);
                 }
             }
         }
     }
 }
예제 #4
0
 private void SaveResults(IEnumerable <CompareResult> analiticResults)
 {
     foreach (CompareResult compareResult in analiticResults)
     {
         try
         {
             if (compareResult.AccessId != -1 || this._device.SaveNonCategory)
             {
                 BcLog log = CompareRequest.FrameToLogBcLog(compareResult.SourceFrame);
                 log.FaceId  = compareResult.FaceId;
                 log.ImageId = compareResult.ImageId;
                 log.Score   = Convert.ToSingle(compareResult.Score);
                 this.SaveLog(log);
                 ++this._device.ResultCount;
             }
         }
         catch (Exception ex)
         {
             this._logger.Error((object)"Error saving - ", ex);
         }
     }
 }