Dual Sigmoid Loss for Face Recognition
- Dual Sigmoid Loss is a loss formulation that decouples the intra-class pull and inter-class push forces using parameterized sigmoid functions.
- It enables explicit control over embedding clusters by tuning sigmoid parameters, thereby mitigating overfitting in noisy data scenarios.
- Empirical results show that SFace with Dual Sigmoid Loss yields competitive accuracy and robustness on benchmarks like LFW, MegaFace, and IJB-C.
Dual Sigmoid Loss, as introduced in the SFace (“Sigmoid-Constrained Hypersphere Loss”) framework, is a loss formulation for deep face recognition that decouples the intra-class “pull” and inter-class “push” forces by modulating their gradient contributions with two independent, parameterized sigmoid functions. This construction allows for explicit control over where and how strongly each sample is encouraged to cluster with its class center or to separate from other classes on the unit hypersphere. By tuning these dual sigmoids, SFace mitigates overfitting, especially in the presence of noisy or low-quality training data, and achieves robust, discriminative face embeddings (Zhong et al., 2022).
1. Mathematical Formulation and Notation
The embedding of input is produced by the network and both and each class center (the columns of the last-layer weight matrix ) are -normalized: . The angular similarity between and is given by and 0.
The SFace loss for 1 is:
2
where
3
4
The 5 operator is the block-gradient, meaning the value is used in the forward pass but not differentiated through during backpropagation.
2. Dual Sigmoid Re-Scale Functions
SFace employs two independent sigmoid functions to modulate the intra-class and inter-class gradient scales as a function of angle 6:
- Intra-class (pull) re-scale:
7
8
- 9 controls sharpness; 0 is the inflection (“onset”) angle; 1 is a global scale (commonly 64).
- For 2, intra-class pull is suppressed; above 3, it ramps up.
- Inter-class (push) re-scale:
4
5
- 6, 7 parameterize slope and margin.
- For 8, inter-class push is strong; for 9, push is negligible.
These dual sigmoids allow fine-grained, decoupled control: one can enforce tight clustering for clean data (low 0), but increase 1 to halt “pull” early in noisy scenarios and avoid overfitting.
3. Gradient Modulation and Optimization Behavior
Only the cosine terms receive backpropagated gradients; the sigmoid re-scales act as fixed coefficients during each update. Specifically,
2
3
Since 4, the gradient magnitudes with respect to 5 are
6
Thus, SFace directly determines the effective angular “pull” or “push” based on how far samples are from the decision margins, defined by the chosen 7 and 8.
4. Parameter Tuning and Loss Behavior Under Noise
Parameter selection critically shapes the embedding geometry:
- 9: Sets the “target” intra-class angle. Higher 0 increases noise tolerance by ceasing intra-class pull earlier, making embeddings looser; lower values enforce tighter clusters.
- 1: Controls gradient sharpness at the intra-class boundary.
- 2: Sets the angular margin for inter-class separation; typical values are 3–4 radians (5).
- 6: Slopes chosen so the transition region is narrow but not a step (e.g., 7).
In practice, higher 8 values help SFace prevent overfitting when label noise increases, as noisy samples are not forcefully incorporated into incorrect clusters. On clean datasets, lower 9 supports compact representations.
| Scenario | 0 (example) | 1 (example) | Impact |
|---|---|---|---|
| Clean (little noise) | 0.80 | 1.20 | Tight clusters, clear separation |
| Noisy (label noise grows) | 0.84 | 1.20 | Early pull-off, less overfitting to noise |
5. Comparison to Other Hypersphere Margin Losses
Traditional angular-margin losses (SphereFace, CosFace, ArcFace) impose margin constraints via additive or multiplicative angular shifts:
- SphereFace: 2,
- ArcFace: 3,
- CosFace: logit margin-shifting by 4.
Gradients in those schemes involve implicit, coupled re-scale factors 5 and 6 that depend on all logits simultaneously and cannot be independently tuned. SFace’s design offers explicit, independent re-scaling for intra- and inter-class terms, and operates solely on single angles (not mixtures thereof), thus simplifying tuning and offering robust performance under non-ideal data conditions.
6. Implementation Details
A standard SFace pipeline consists of:
- Network (e.g., ResNet50) generating a 7-dimensional feature vector per sample, followed by 8 normalization.
- Last-layer weights 9, columns 0-normalized per forward pass.
- For each sample, compute 1 and 2 via 3.
- Compute 4 and 5 via the parameterized sigmoid functions, with gradients blocked.
- Loss assembly: 6
- SGD updates are applied to both 7 and network parameters.
7. Empirical Results and Significance
SFace demonstrates competitive or superior accuracy and robustness across diverse benchmarks:
- On MS1MV2 with ResNet100 and 8:
- LFW: 99.82% (ArcFace 99.83%)
- YTF: 98.06% (ArcFace 98.02%)
- MegaFace: Top-1 = 98.50% (ArcFace 98.35%), TAR@FAR = 98.61% (ArcFace 98.48%)
- IJB-C: 1:1 TAR@FAR=1e-5–1e-1 improved over ArcFace by 0.5–1%
- Under increasing label-noise (WebFace, 0–20%), SFace’s accuracy degrades more gracefully than ArcFace or CosFace, as 9 is increased to limit the effect of noisy samples.
- On IJB-A and IJB-C, SFace consistently outperforms ArcFace by 0.2–0.5% at low FAR and in Rank-1/TPIR metrics.
This suggests that the decoupled, sigmoidal gradient modulation offers a robust means to balance discriminative training against overfitting, particularly with imperfect data (Zhong et al., 2022).