Fotograma de la película "Ivan Vasilievich cambia de profesión"
? , - . — , . . — , , , .
- .
:
- (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), :
La escala es nuestro primero de dos hiperparámetros. Arreglarlo para todos los vectores conduce al hecho de que ahora están ubicados en la hiperesfera. En una versión 2D, se ve así (un color - una clase):
Imagen del artículo de ArcFace , un ejemplo de juguete para demostración: cada clase está resaltada con su propio color, cada punto del círculo es una imagen tomada por separado, el vector medio de cada clase está conectado al centro para mayor claridad. Tenga en cuenta que las clases están conectadas "sin espacios".
Reescribamos Softmax Loss (ahora llamado Normalized Softmax Loss, N-Softmax) con estas observaciones en mente:
Hemos dividido la suma en el denominador en dos términos para facilitar la explicación. Todas las funciones de pérdida importantes para el reconocimiento facial se basan en 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