Facial Recognition & Clustering
Key Person Agglomerative Clustering
Grouping wedding VIPs and subjects into identity clusters with avatar asset generation.
Unsupervised Identity Discovery
During a 3,000-frame shoot, a photographer captures hundreds of individuals across varying lighting, angles, and attire. BestShots automatically groups these appearances into coherent person profiles using greedy agglomerative clustering.
Cosine Distance Metric & Thresholds
Clustering compares 512-dimensional vector pairs using cosine distance:
Distance(A, B) = 1 - (A · B) / (||A|| * ||B||)
- Identity Threshold: Vectors with cosine distance
< 0.58are clustered into the same person identity. - Outlier Rejection: Distances
>= 0.58spawn separate individual candidate groups. - Centroid Recomputation: As additional frames are assigned, the identity centroid updates dynamically to accommodate slight profile rotations and lighting shifts.
Avatar Crop Asset Generation
For each identified KeyPerson, the pipeline selects the highest-scoring face detection as the reference avatar:
- 25% Padding Margin: Adds a 25% safety margin around detected bounding box coordinates to ensure full hairline, chin, and ears are captured.
- Aspect Ratio Center Compensation: Adjusts crop dimensions so circular avatars display natural centering without clipping forehead or necklines.
- Sharp WebP Pipeline: Renders a dedicated 256×256 WebP avatar stored in Azure Blob Storage and linked to the project sidebar for 1-click subject filtering.