| # Vision & Face Recognition Audit |
|
|
| The Face Recognition system is located in `backend/Face_Recognition`. |
|
|
| ## Key Findings: |
| 1. **Matcher Engine**: `FaceMatcher` handles operations via `InsightFace` models. |
| 2. **Embedding Storage**: Enrollments are saved as `.npy` files. Stored inside `faces_db` and `temp_faces_db`. |
| 3. **Concurrency**: It employs thread locks (`threading.Lock()`) for updating the embedding dict safely across background refreshes and API calls. |
| 4. **Background Refresh**: Boot sequence kicks off a thread to refresh stale embeddings without blocking startup. |
| 5. **Dynamic Thresholds**: Reads defaults via env vars (`FACE_MATCH_THRESHOLD`) but overrides them based on a `PERSON_THRESHOLDS` mapping for predefined demo identities (mk, urvi, vidit), ensuring fewer false positives. |
|
|
| ## Recommendations: |
| - Transition from file-based `.npy` lookups to a vector database if the identity count exceeds a few thousand. |
| - Ensure the background thread handles InsightFace GPU resource contention if any. |
|
|