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