How mosidas/face-recognition works
Project Type and Purpose
• This is a multi‐application .NET 8.0 system for real‐time object detection and face recognition using ONNX models.
• It consists of a core library (“Recognizer”), a small utility library, multiple runnable apps (CLI, console real‐time detectors, unified detector, WPF UI), and a Python‐based ONNX analysis tool.
File Structure Analysis
• Top‐level:
• Recognizer core library in src/Recognizer
• Utility helpers in src/Utility
• Five consumer apps in src/ExampleCLI, src/RealTimeDetector, src/RealTimeFaceRecognizer, src/UnifiedDetector, src/WPFDetectorApp
• A tools folder (tools/onnx-analyzer) for model inspection
• face-recognition.sln and README.md for overall solution definition
• Each app project references Recognizer (and occasionally Utility). Apps are thin shells driving the detection/recognition pipeline.
• Configuration/deployment hints: .csproj files, Program.cs, App.xaml for WPF, and a Python pyproject.toml for the analyzer.
Key Insights from README
• Core functionality is ONNX‐based YOLO face/object detection and ArcFace (or similar) recognition.
• Multiple frontends (CLI, console, WPF).
• External resources: ONNX model files, reference face images, camera hardware (including infrared).
• GPU acceleration via CUDA supported.
Components
a. Main components:
• Recognizer Library (src/Recognizer)
• Utility Library (src/Utility)
• ExampleCLI app
• RealTimeDetector app
• RealTimeFaceRecognizer app
• UnifiedDetector app
• WPFDetectorApp (UI + Services)
• External ONNX Models (face_detector.onnx, object_detector.onnx, face_recognizer.onnx)
• External Inputs: Camera (RGB/IR), Reference Face Image Store
• Python ONNX Analyzer (tools/onnx-analyzer)
b. Relationships & Interactions:
• Each app → references → Recognizer Library
• Recognizer → uses → OnnxHelper → loads → ONNX Models
• Apps → read → camera frames → send to Recognizer → receive detections/recognitions → render to console or UI
• UnifiedDetector → orchestrates both object and face detectors and optionally smartphone auth
• Utility Library → provides Encipher, FloatConverter (used by Recognizer or apps)
• WPFDetectorApp → UI layer (XAML) → calls CameraService & LoggingService → passes frames into Recognizer
• ONNX Analyzer (Python) → dev‐time tool, independent from runtime apps
c. Architectural Patterns & Principles:
• Layered architecture:
• Layer 1: External hardware/resources (Camera, Model files)
• Layer 2: Core/Utility libraries (Recognizer, Utility)
• Layer 3: Application layer (CLI, console, UI)
• Dependency Inversion: High‐level apps depend on abstractions in Recognizer rather than on ONNX directly
• Separation of concerns: Core ML logic is isolated from presentation/UI and from tooling
d. Key Technologies & Frameworks:
• .NET 8.0, C# projects
• ONNX Runtime (via OnnxHelper) with CUDA support
• YOLOv8n-face / YOLOv11-face detectors and ArcFace/face_recognition models
• WPF (XAML/C#) for the Windows UI
• Python 3 (pyproject.toml) for ONNX model analysis
Essential Details
• ONNX model loading as a separate sub‐component inside Recognizer (OnnxHelper).
• GPU acceleration path if relevant (e.g., annotate ONNX runtime with “CUDA”).
• Two main data flows: object detection and face recognition, and how UnifiedDetector merges them.