cosface_sphere20
A 20-layer residual CNN that maps aligned face crops to features for face recognition.
Image classification · 50 operations Checked
Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.
At a glance
- Task
- Image classification
- Parameters
- 22.7M
- Operations
- 50
- Framework
- PyTorch
- Recurrent
- No
- Published
- CVPR 2017
- Cited by
- 3,118 (as of 21 October 2026)
- Authors
- Weiyang Liu, Yandong Wen, Zhiding Yu and others
- Source
- GitHub: wy1iu/sphereface
- License
- MIT
- Checked
- Passed: the trace was replayed operation by operation and matched the model's own output for this input.
Files
The file opened in a new tab. Use your browser's Save command there to keep it.
The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.
Details
- Stable ID
- m3946
- Graph hash
- 7aaa37260d4141091e04ab02f2b1e6ac0efee25ca96e84c4fa8411e675ede390
- Skeleton hash
- 7619b672e11d1532e6c7acac2d5dfd4a1f421d324e55dd7f7a0fccd4f59fee57
- Architecture hash
- 54bb05267166c81d8ca48c65712907eebed084646b1e4f28ab232b98d5539f9a
- Diagram SHA-256
- e22e01f481a998f3820cde415d972184150a83c5ed369240df66b0406476ee6e
- TorchLens version
- 2.36.0
- Renderer
- graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
- Check
- Forward pass replayed in PyTorch
What it is
SphereFace-20 is the 20-layer CNN architecture described in the SphereFace paper for face recognition. It serves open-set face recognition, where the testing identities are usually disjoint from the training set, so faces must be mapped to a discriminative feature space instead of being classified. Features are extracted from the output of the FC1 layer, and the score for two faces is computed by the cosine distance of their features.
The network uses residual units as building blocks but differs from the standard ResNets: BatchNorm is not used and the prelu replaces the relu. Input faces are detected with MTCNN, aligned by a similarity transformation on 5 facial points, and resized to 112 × 96.
SphereFace trains its networks with the angular softmax (A-Softmax) loss, which enables CNNs to learn angularly discriminative features. CosFace instead reformulates the softmax loss as a cosine loss by L2 normalizing both features and weight vectors, then introduces a cosine margin term. A PyTorch implementation of CosFace offers this network as sphere20, and its readme lists Sphere20 at 99.08% accuracy on LFW with s=30, m=0.35 and 99.23% with m=0.40.
Key idea. SphereFace trains a residual CNN with an angular softmax loss so that face features become angularly discriminative, and CosFace proposes a large margin cosine loss for the same aim.
- SphereFace-20
- sphere20
- cosface_sphere20
- SphereFace
- CosFace
- A-Softmax
- large margin cosine loss
- face recognition
- face verification
- angular margin
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
Cite the paper
@misc{liu2018spherefacedeephypersphereembedding,
title={SphereFace: Deep Hypersphere Embedding for Face Recognition},
author={Weiyang Liu and Yandong Wen and Zhiding Yu and Ming Li and Bhiksha Raj and Le Song},
year={2018},
eprint={1704.08063},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/1704.08063},
}