
Standbild aus dem Film "Ivan Vasilievich wechselt seinen Beruf"
? , - . — , . . — , , , .
- .
:
- (backbone) — , , , — , . InsightFace — Open Source .
- (embedding) — , . 128 512. , 512. : . , , , — . , ( ) 1, — -1 ( 0).
- Embedding- — , , ( ) .
- — , ( ) , — , — . , — ( ), — , — . softmax.
, , . — , , . — ( — ), — . .
: (metric learning) .
, . — Triplet Loss:
:
- — anchor, , ;
- — positive, ;
- — negative, ;
- — , .
, , - .
, ( — ), , , embedding- .
Triplet Loss , “ ”, , , SotA , . , Triplet Loss (fine-tuning) . , .
, , , , , . :
— , ( 512), — ( , ). — () , . , “ ” . : , , . . , :

: , , , . , . , , Triplet Loss — , , (hard sampling), .
— , , : Softmax Cross Entropy — . Softmax Loss.
Softmax Loss
Softmax, . :
- — ()
- — embedding-,
- — bias,
, ( , embedding- ): . Softmax() :
— Cross Entropy, Softmax Loss :
— . , , 42, 42- .
— , .
: — : , . , . :
- , — ( ), — ( 512).
- , — .
, .
, :
, : — , . , , (), s (scale), :
Die Skala ist unser erster von zwei Hyperparametern. Das Fixieren für alle Vektoren führt dazu, dass sie sich jetzt auf der Hypersphäre befinden. In der 2D-Version sieht es ungefähr so aus (eine Farbe - eine Klasse):
Bild aus dem ArcFace- Artikel , ein Spielzeugbeispiel zur Demonstration: Jede Klasse wird mit einer eigenen Farbe hervorgehoben, jeder Punkt auf dem Kreis ist ein separat aufgenommenes Bild, der mittlere Vektor jeder Klasse ist aus Gründen der Klarheit mit der Mitte verbunden. Beachten Sie, dass die Klassen "ohne Lücken" verbunden sind.
Schreiben wir den Softmax-Verlust (jetzt als normalisierter Softmax-Verlust, N-Softmax bezeichnet) unter Berücksichtigung dieser Beobachtungen neu:
Wir haben die Summe im Nenner zur Vereinfachung der weiteren Erklärung in zwei Begriffe unterteilt. Alle wichtigen Verlustfunktionen für die Gesichtserkennung basieren auf N-Softmax.
Margin-Based Loss
, , — . softmax loss, . , (decision boundary), ( ). . ? () , . — (decision margin). — margin — , : scale — . 2D ( ArcFace):

— margin, — margin
, .
, margin ( ) :
. . : Large-Margin Softmax Loss SphereFace. , , Margin-based loss. :
margin . . : AM-Softmax CosFace , , , . :
margin : → . ArcFace. ArcFace :
, ArcFace AirFace. Margin , ArcFace, , (). , , ( — ), , , , :
margin — , — ( ArcFace).
Margin & Scale
- , , — scale (s) margin (m), . , AM Softmax , , ArcFace — , a , CosFace (, , AM Softmax) , a . , , “ ”, .
— AdaCos, — scale margin . :
- Margin scale — , .
- scale margin, margin scale.
- scale .
- — scale
2 20 , , Y — , , X — . , , , :
scale ( , , margin 0), — margin scale=30. , scale, “” , margin X. , — scale margin, - , ? AdaCos scale ( ). , : , — . s [10, 25], .
AdaCos — scale. , scale , . , , .
margin , , , ? . X , Y — ( N-softmax ):
: CosFace N-softmax , ArcFace — . SphereFace, , . ArcFace — target logit, , , . , , ( ). , (, ) , :
# cosine - cos(theta) # phi - cos(theta + m) # th - cos(math.pi - m) # mm - sin(math.pi - m) * m if easy_margin: phi = torch.where(cosine > 0, phi, cosine) else: phi = torch.where(cosine > th, phi, cosine - mm)
easy_margin , :

Easy margin , N-Softmax (), not easy margin . , , , , “”, , , .
Loss LFW MegaFace, Rank1 @ MegaFace, Tar @ Far AM-Softmax/CosFace 99.33 0.9833 0.9841 ArcFace 99.83 0.9836 0.9848 SphereFace 99.42 0.9743 0.9766
Loss Resnet50-MSC MobileNet-MSC Resnet50-Casia MobileNet-Casia AM-Softmax/CosFace 99.3 97.65 99.34 98.46 ArcFace 99.15 98.43 99.35 99.01 SphereFace 99.02 96.86 99.1 97.83
, ArcFace SotA .
. (margin) , . AM Softmax ( ) ArcFace ( ). , , , AirFace.
:
SphereFace https://arxiv.org/abs/1704.08063
AM Softmax https://arxiv.org/abs/1801.05599
CosFace https://arxiv.org/abs/1801.09414
ArcFace https://arxiv.org/abs/1801.07698
AirFace https://arxiv.org/abs/1907.12256
:
Deep Face Recognition: A Survey https://arxiv.org/abs/1804.06655
A Performance Evaluation of Loss Functions for Deep Face Recognition https://arxiv.org/abs/1901.05903