TKK_E32232028/README_RECOG.md

1001 B

Face recognition quick start

  1. Activate venv:
source .venv/bin/activate
  1. Enroll a person (use a photo with a clear face):
python enroll_faces.py alice /path/to/alice.jpg
  1. 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=False and uses the OpenCV backend as a fallback.
  • For best results, enroll multiple photos per person with different poses and lighting.