Face Recognition Playground
A modular face verification system built on DeepFace.
Project Structure
face/
├── conf/ # Hydra configuration
│ ├── config.yaml # Main config
│ └── dataset/
│ ├── lfw.yaml # LFW dataset paths
│ └── agedb.yaml # AgeDB dataset paths
├── src/
│ ├── utils.py # Timestamped output dirs, image listing
│ ├── data_loader.py # Load img.list and pair.list files
│ ├── detection.py # Face detection + alignment + cropping
│ ├── extraction.py # CNN embedding extraction
│ ├── comparison.py # Pairwise distance scoring
│ └── evaluation.py # Thresholding, evaluation metrics and curves
├── main.py # Hydra entry point — runs the pipeline
├── compare_runs.py # Compare multiple experiment runs
├── requirements.txt # Python dependencies
└── data/ # Datasets (tracked with Git LFS)
├── lfw/
│ ├── imgs/ # Face images
│ ├── img.list # Image path list
│ └── pair.list # <id1> <id2> <label> (1=genuine, 0=impostor)
└── agedb/
├── imgs/ # Face images
├── img.list # Image path list
└── pair.list # <id1> <id2> <label> (1=genuine, 0=impostor)
Installation
pip install -r requirements.txt
Usage
All configuration is via Hydra. Override any setting from the CLI.
# Full pipeline (default: LFW, ArcFace, RetinaFace, cosine)
python main.py
# Switch dataset
python main.py dataset=agedb
# Override model, detector, metric
python main.py model.name=Facenet512
python main.py detection.backend=mtcnn
python main.py comparison.metric=l2
# Choose threshold method for evaluation (eer, std, chefboost)
python main.py evaluation.threshold_method=chefboost
python main.py evaluation.threshold_method=std evaluation.std_multiplier=3
# Run from a specific stage onward (runs that stage + all subsequent stages)
python main.py stage=detect # detect → extract → compare → evaluate
python main.py stage=extract # extract → compare → evaluate
python main.py stage=compare # compare → evaluate
python main.py stage=evaluate # evaluate only
Reusing a Previous Run (source_run)
To re-run comparison and/or evaluation with different settings (e.g. a different
threshold method or metric) without repeating the expensive detection and
extraction steps, point source_run at an existing run directory. The pipeline
copies detection results, embeddings and crops into a new timestamped run, then
executes from the stage you specify onward.
# Re-evaluate an LFW run with ChefBoost threshold
python main.py dataset=lfw \
source_run=outputs/lfw/2026-03-06_22-12-26 \
stage=evaluate \
evaluation.threshold_method=chefboost
# Re-evaluate with std threshold and different multiplier
python main.py dataset=agedb \
source_run=outputs/agedb/2026-03-06_22-46-20 \
stage=evaluate \
evaluation.threshold_method=std \
evaluation.std_multiplier=3
Note: source_run accepts a relative path (resolved from the workspace
root) or an absolute path. The original run is never modified — a fresh
timestamped directory is always created.
Output
Each run produces a timestamped directory:
outputs/<dataset>/<YYYY-MM-DD_HH-MM-SS>/
├── config.yaml # Resolved config snapshot (for reproducibility)
├── crops/ # Detected + aligned face crops
├── detection_results.csv # Detection log (filename, detected, confidence, bbox)
├── embeddings.npy # Feature vectors
├── embedding_ids.csv # Index → filename mapping
├── scores.csv # Pairwise comparison scores + labels
└── evaluation/
├── metrics.json # Metrics
├── roc_curve.png
├── det_curve.png
└── score_distribution.png
Comparing Runs
Compare any number of experiment runs:
python compare_runs.py outputs/lfw/run1 outputs/lfw/run2 -o my_comparison
Generates:
metrics_comparison.csv — side-by-side metric table
roc_comparison.png — overlaid ROC curves
score_distributions.png — score histograms per run
detection_disagreements.csv — images where detectors disagree
comparison_report.txt — full text report
Configuration Reference
| Config key |
Default |
Options |
dataset |
lfw |
lfw, agedb |
stage |
detect |
detect, extract, compare, evaluate — runs from this stage onward |
source_run |
null |
Path to existing run dir to copy artifacts from |
detection.backend |
retinaface |
retinaface, mtcnn, opencv, ssd, mediapipe, yolov8 |
detection.confidence_threshold |
0.9 |
float |
detection.align |
true |
bool |
detection.crop_size |
[112, 112] |
list[int] |
model.name |
ArcFace |
ArcFace, Facenet, Facenet512, VGG-Face, SFace, OpenFace |
comparison.metric |
cosine |
cosine, l2, l2_normalized |
evaluation.threshold_method |
eer |
eer, std, chefboost |
evaluation.std_multiplier |
2 |
float (only for std method) |
evaluation.target_fars |
[0.01, 0.001, 0.0001] |
list[float] |