private void DetectObjects(Texture2D input_tex)
        {
            text_result = "";

            float startOCRt = Time.realtimeSinceStartup;

            //face and object detection.
            var outputs = _detector.RunInference(input_tex);
            var face    = faceMng.RecognizeFace(input_tex);

            var classNames = outputs.Select(x => x.Key).ToList();
            var classes    = classNames.GroupBy(x => x).ToDictionary(x => x.Key, x => x.ToList().Count);

            foreach (var label in classes)
            {
                if (text_result == String.Empty)
                {
                    text_result = $"{label.Key} {label.Value}";
                }
                else
                {
                    text_result = $"{text_result}, {label.Key} {label.Value}";
                }
            }

            if (face != "Δεν εντοπίστηκε πρόσωπο" && face != "Δεν αναγνωρίστηκε")
            {
                text_result = $"{text_result}, εντοπίστηκε οικείο πρόσωπο με όνομα {face}";
            }

            float endOCRt = Time.realtimeSinceStartup;

            detectionTime = GenericUtils.CalculateTimeDifference(startOCRt, endOCRt);

            inferenceComplete = true;
        }
Пример #2
0
 public List <Rect> GetDetectionBoxes(Texture2D img_Texture)
 {
     _faceDetector.RunInference(img_Texture);
     return(_faceDetector.GetDetectionBoxes());
 }