1001 B
1001 B
Face recognition quick start
- Activate venv:
source .venv/bin/activate
- Enroll a person (use a photo with a clear face):
python enroll_faces.py alice /path/to/alice.jpg
- Recognize from an image:
python recognize.py /path/to/query.jpg
Notes:
- Scripts use
src/face.xml(Haar cascade) for quick face cropping, then DeepFace (Facenet) to compute embeddings. - First time calling DeepFace, models will be downloaded (internet required).
- Embeddings are stored in
embeddings/NAME.json. - You can tweak model (
model_name) or comparison metric.
Notes about enrollment accuracy:
- The enrollment script pads and resizes detected face crops before computing embeddings. This helps DeepFace detectors work on small/tight crops.
- If DeepFace's detector fails on the crop, the script retries with
enforce_detection=Falseand uses the OpenCV backend as a fallback. - For best results, enroll multiple photos per person with different poses and lighting.