31 lines
1001 B
Markdown
31 lines
1001 B
Markdown
Face recognition quick start
|
|
|
|
1) Activate venv:
|
|
|
|
```bash
|
|
source .venv/bin/activate
|
|
```
|
|
|
|
2) Enroll a person (use a photo with a clear face):
|
|
|
|
```bash
|
|
python enroll_faces.py alice /path/to/alice.jpg
|
|
```
|
|
|
|
3) Recognize from an image:
|
|
|
|
```bash
|
|
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.
|