예제 #1
0
        private static void RunOptions(FaceRecognitionParams facePars)
        {
            //var c = new CudaFaceEyeDetector("a", "b");
            var surveillance = new Surveillance(
                VideoGrabFactory.GetMockCamera(facePars.TestSet), new FileSystemDAL(facePars.DataSet), facePars.Confidence);

            surveillance.EnsureTrained();
            surveillance.Start();
            //RunTestData(surveillance, DebugHelper.OutputPath);
            Console.ReadKey();
        }
예제 #2
0
        private static void RunOptions(FaceRecognitionParams facePars)
        {
            var images          = GetImages(facePars.DataSet).ToList();
            var detectionModule = new DetectionModule(facePars);

            var faces = detectionModule
                        .GetFaces(images)
                        .Select(f => (GetPersonName(f.Item1), f.Item2))
                        .ToList();
            var labelMap     = new LabelMap(faces.Select(f => f.Item1).Distinct());
            var labeledFaces = faces.Select(f => (labelMap.Map[f.Item1], f.Item2));

            var testImages        = GetImages(facePars.TestSet).ToList();
            var recognitionModule = new FaceRecognitionModule();

            recognitionModule.Train(labeledFaces.ToList(), facePars.Embeddings);

            foreach (var(name, bytes) in testImages)
            {
                var testImg    = detectionModule.ProcessImage(bytes);
                var prediction = recognitionModule.Predict(testImg);
                Console.WriteLine($"Img name : {name} Prediction: {labelMap.ReverseMap[prediction.Label]}, Dist : {prediction.Distance}");
            }
        }