Implementation of related angular-margin-based classification loss functions for training (face) embedding models: SphereFace, CosFace, ArcFace and MagFace.
I stumbled across your repository to compare different approaches for computing face embeddings.
I like your approach to construct the ArcMarginHeader class as base class for all other approaches.
However, when training a model with the ArcFaceHeader, I noticed two flaws in your ArcMarginHeader class.
Hi,
I stumbled across your repository to compare different approaches for computing face embeddings. I like your approach to construct the ArcMarginHeader class as base class for all other approaches. However, when training a model with the ArcFaceHeader, I noticed two flaws in your ArcMarginHeader class.
Both flaws appear in the
forward()
function:line 28:
You need to initialize the weight parameter when initializing the header class instead of initiliazing it again in every forward pass.
line 32:
The arccos must not be clamped to (-1, 1), as the returned function values are between 0 and pi.
I will create a PR that fixes both issues.