core/nn/vision/vit_face_embedding library
Face-embedding head on top of a Vision Transformer backbone.
Wraps a ViTBackbone plus an optional Linear(embedDim, outputDim)
projection to a fixed embedding size (default 512), and finishes
with row-wise L2 normalization so pairwise cosine similarity is
just a dot product. Train with a metric-learning loss (triplet,
contrastive, ArcFace, etc.) on top of the returned [1, outputDim]
vector.
The L2 norm is composed from primitives:
y = x / sqrt(sum(x*x) + eps). This is fine for single-row output
(batch = 1 face at a time). For batched face embeddings, add a
per-row reduction op and use it here instead.