ArcFace is a loss function that normalizes both the features and the weights of the classification layer to unit length, adds a constant to the angle between a feature and the weight of its target class, converts the result back with cos, and then computes the loss with softmax and cross-entropy. The paper calls it the Additive Angular Margin Loss. Deng et al. proposed it in 2019 for face recognition.
is the angle between the feature and the weight of class , is the target class, is a constant multiplied into every logit (the scale), and is the margin. The paper uses and (radians, about 28.6°).
There were two main ways to train face recognition networks.
- Train as classification (softmax loss): People seen in training can be separated, but the features are not discriminative enough to tell apart people not seen in training. The size of the classification layer's weight also grows in proportion to the number of identities.
- Learn the embedding directly (Triplet Loss): The number of triplets explodes with the amount of data, and selecting triplets that are useful for training becomes difficult.
Along the line of improving the classification loss, Center loss pulls features of the same class toward the class center, SphereFace introduced a margin that multiplies the angle by , and CosFace a margin that subtracts from the cosine. The ArcFace paper notes that SphereFace relies on a series of approximations, which makes training unstable and requires mixing it with the ordinary softmax loss, and that CosFace is simpler and performs better. Building on this, it proposes adding directly to the angle.
When features and weights have unit length, the angle equals the arc length on the unit hypersphere (the geodesic distance). Adding to the angle therefore means estimating the distance to the target class center on the hypersphere as farther in arc length. The left side of the figure at the top shows the decision regions when the two class weights are 90° apart: a band of about 29°, equal to , is classified as neither class.


