Loss Functions

Additive Angular Margin Loss

Introduced by Deng et al. in ArcFace: Additive Angular Margin Loss for Deep Face Recognition

ArcFace, or Additive Angular Margin Loss, is a loss function used in face recognition tasks. The softmax is traditionally used in these tasks. However, the softmax loss function does not explicitly optimise the feature embedding to enforce higher similarity for intraclass samples and diversity for inter-class samples, which results in a performance gap for deep face recognition under large intra-class appearance variations.

The ArcFace loss transforms the logits $W^{T}_{j}x_{i} = || W_{j} || \text{ } || x_{i} || \cos\theta_{j}$, where $\theta_{j}$ is the angle between the weight $W_{j}$ and the feature $x_{i}$. The individual weight $ || W_{j} || = 1$ is fixed by $l_{2}$ normalization. The embedding feature $ ||x_{i} ||$ is fixed by $l_{2}$ normalization and re-scaled to $s$. The normalisation step on features and weights makes the predictions only depend on the angle between the feature and the weight. The learned embedding features are thus distributed on a hypersphere with a radius of $s$. Finally, an additive angular margin penalty $m$ is added between $x_{i}$ and $W_{y_{i}}$ to simultaneously enhance the intra-class compactness and inter-class discrepancy. Since the proposed additive angular margin penalty is equal to the geodesic distance margin penalty in the normalised hypersphere, the method is named ArcFace:

$$ L_{3} = -\frac{1}{N}\sum^{N}_{i=1}\log\frac{e^{s\left(\cos\left(\theta_{y_{i}} + m\right)\right)}}{e^{s\left(\cos\left(\theta_{y_{i}} + m\right)\right)} + \sum^{n}_{j=1, j \neq y_{i}}e^{s\cos\theta_{j}}} $$

The authors select face images from 8 different identities containing enough samples (around 1,500 images/class) to train 2-D feature embedding networks with the softmax and ArcFace loss, respectively. As the Figure shows, the softmax loss provides roughly separable feature embedding but produces noticeable ambiguity in decision boundaries, while the proposed ArcFace loss can obviously enforce a more evident gap between the nearest classes.

Other alternatives to enforce intra-class compactness and inter-class distance include Supervised Contrastive Learning.

Source: ArcFace: Additive Angular Margin Loss for Deep Face Recognition

Papers


Paper Code Results Date Stars

Tasks


Task Papers Share
Face Recognition 48 31.79%
Face Verification 14 9.27%
Retrieval 8 5.30%
Image Retrieval 6 3.97%
TAR 5 3.31%
Face Identification 5 3.31%
Adversarial Attack 4 2.65%
Metric Learning 3 1.99%
Image Classification 3 1.99%

Components


Component Type
🤖 No Components Found You can add them if they exist; e.g. Mask R-CNN uses RoIAlign

Categories