# Deep Learning Face Representation by Joint Identification-Verification

Joint identification and verification signals train face features that generalize to unseen people

Yi Sun, Xiaogang Wang, Xiaoou Tang · arXiv · 2014-6-18

- **Problem** Face recognition needs features that shrink variation within one person while separating different people. Identification training separates people only loosely and does not pull same-person images together, so earlier linear and shallow methods remained limited.
- **Method** DeepID2 adds a verification loss to identification training for face features.
- **Results** The method reaches 99.15% face verification accuracy on LFW, a 67% error reduction against the best deep learning result cited. A single 25-patch model reaches 98.97%.

## Why identity labels alone fall short

Pose, lighting, expression, age and occlusion can make two images of one person differ more than images of two different people, so a useful representation must shrink spread within a person while keeping different people apart. Early subspace methods such as LDA handled this with linear projections that trade off between the two kinds of variation, and metric learning methods learned mappings that bring same-person faces together, but both remain limited by linear or shallow structure.

A classifier over thousands of identities pushes different people apart, because each person must land in a different class. It places only a loose constraint on images of the same person, since two dissimilar feature vectors can still be mapped to one class. The authors therefore add a verification term that acts directly on the distance between two feature vectors, which is the piece the identification signal lacks.

## How the two losses are written and weighted

The identification branch puts an n-way softmax on top of the DeepID2 layer, with n = 8192 in the main setting, and trains it with cross-entropy. Because the target distribution is one-hot, the loss reduces to the negative log of the predicted probability of the target class. Written out, \\( \\mathrm{Ident}(f,t,\\theta\_{id}) = -\\log \\hat{p}\_t \\), where f is the DeepID2 vector, t the target identity, and θid the softmax parameters.

The verification loss on a pair of DeepID2 vectors f\_i and f\_j takes two forms depending on the label y\_ij. For y\_ij = 1 it is \\( \\tfrac{1}{2}\\lVert f\_i-f\_j\\rVert\_2^2 \\), which pulls same-identity vectors together; for y\_ij = -1 it is \\( \\tfrac{1}{2}\\max(0,\\, m-\\lVert f\_i-f\_j\\rVert\_2)^2 \\), which only penalizes different-identity pairs whose distance is still below the margin m.

The margin m is a learned parameter in name only, since a gradient step would always push it in one direction; the authors instead set it to the threshold that gives the lowest verification error on recent training pairs.

Training samples two images per step, computes both identification gradients and the verification gradient, and weights the verification part by λ before updating the ConvNet, softmax and verification parameters with stochastic gradient descent. Only θc, the ConvNet parameters, is needed at test time, so the softmax and verification parameters act as training-time scaffolding.

The cosine-based alternative replaces the distance with a sigmoid over a scaled and shifted cosine similarity, and an L1-based version is also possible. All three verification formulations are compared in the experiments.

## The ConvNet and where DeepID2 is read

The network has four convolutional layers, and the first three are followed by max-pooling. The third layer shares weights only within each 2×2 local region, so its filters vary across the map, and the fourth layer is locally connected with no weight sharing between neurons. The layout follows an earlier deep ConvNet from the same group, and the less sharing in higher layers is meant to let the network learn a diverse set of high-level features.

The DeepID2 layer is fully connected to both the third and the fourth convolutional layers. Since the fourth layer captures more global structure, feeding the DeepID2 layer from both levels gives a multi-scale design. The DeepID2 output is a 160-dimensional vector, and ReLU is used in the convolutional layers and in the DeepID2 layer. The input is an RGB patch of 55×47, and the map sizes later in the network follow from the patch size.

## From aligned faces to a verification score

Each of 200 ConvNets is trained on one patch and its horizontally flipped counterpart, so every face yields 400 DeepID2 vectors of 160 dimensions in total.

The forward-backward greedy algorithm keeps 25 patches that are both effective and complementary, which saves most of the extraction time at test. The 25 selected 160-dimensional vectors are concatenated into a 4000-dimensional vector. That 4000-dimensional vector is compressed with PCA before verification.

Joint Bayesian models a face feature as f = µ + ε, where µ and ε are Gaussian and estimated from training data, so the inter-personal and intra-personal parts are modeled separately. Two faces are judged the same person when the log-likelihood ratio between the inter-personal and intra-personal hypotheses is high enough, with the threshold set on training data.

## Data split used for training and testing

LFW contains 13,233 face images of 5749 identities, and verification is reported on its 6000 given pairs. Because most LFW identities have a single image, the authors do not use it for training. Training draws on CelebFaces+, which has 202,599 images of 10,177 identities, and the authors state that its identities are mutually exclusive with LFW.

8192 CelebFaces+ identities, referred to as CelebFaces+A, are used to learn DeepID2, and the remaining 1985 identities, referred to as CelebFaces+B, are used for feature selection and for fitting Joint Bayesian. CelebFaces+B serves as a validation set for the learning rate, the number of epochs and λ while CelebFaces+A is being trained. Afterwards it is split into 1485 training identities and 500 validation identities for feature selection, and Joint Bayesian is finally fitted on all of CelebFaces+B.

The early experiments use one deep ConvNet on the entire face region, and the full system is assembled only afterwards.

## Weighting the identification and verification signals

The weight λ is swept from 0 to infinity with the L2 norm loss. At λ = 0 only identification acts, and as λ grows verification takes over until only verification remains at infinity. Neither extreme gives the best verification accuracy on the test set, measured with the L2 norm and with Joint Bayesian.

The analysis uses LDA-style scatter matrices. The inter-personal scatter sums over identities the squared deviation of each identity mean from the global mean weighted by its image count, and the intra-personal scatter sums over images the squared deviation from their identity mean. The eigenvalue spectra of these two matrices are the measure of variation diversity.

At λ = 0 both spectra have long tails, meaning large and diverse intra-personal variation sits alongside useful inter-personal diversity. At λ = 0.05 the inter-personal diversity stays similar while its main directions grow, and the intra-personal spectrum shrinks in both magnitude and diversity. At infinity both spectra concentrate on a few directions, and the authors link the resulting drop in accuracy to lost inter-personal diversity.

PCA plots of six LFW identities show the same pattern. At λ = 0 the clusters of different people overlap, although their centers differ, while at λ = 0.05 the clusters separate, and at infinity the centers begin to collapse and some clusters overlap again.

## Identity count and the choice of verification loss

The number of identities used for identification grows exponentially from 32 to 8192, while the verification term always uses all 8192 training identities. Verification accuracy of the learned DeepID2 rises with this number under both the L2 norm and Joint Bayesian, and the authors treat a large identity count as key to good features. They expect more than 8192 identities could improve the result, but this was not tested.

Table 2 compares the L2 loss on all pairs with L2+, which only pulls same-identity pairs together, L2-, which only pushes different-identity pairs apart inside the margin, the L1 loss, the cosine loss, and no verification loss. The identification signal is 8192 identities in every row.

The authors read the L2+ result as showing that most of the verification benefit comes from shrinking same-identity distances. L2- stays close to the no-verification row in both rows of the table, which supports that reading. The authors attribute the advantage of the L2 loss over L1 and cosine to those constraints being weaker, with cosine constraining only the angle and not the magnitude.

## Final system on LFW

The 98.97% result uses 180-dimensional PCA features with Joint Bayesian, and the PCA dimension was chosen by cross-validation on CelebFaces+B, with performance nearly flat between 150 and 250 dimensions.

Extraction time grows with the number of patches, from 1.7 ms for one patch to 35 ms for 25 patches on a single Titan GPU. The patch count therefore trades a small accuracy gain at the top end for a much larger extraction cost.

The 99.15% figure corresponds to a 67% reduction in error rate relative to the best deep learning result cited, reference \[21\]. The authors also set this against the 99.20% human accuracy on LFW, noting that the machine sees only the face region while the human sees the whole image with background. This is a comparison of different inputs rather than a matched experiment.

## Limits of the evidence

Every accuracy reported in the experiments is on LFW under its 6000-pair protocol, and no other benchmark appears in these results. The final result depends on training with 8192 CelebFaces+ identities and on selecting features and fitting Joint Bayesian with CelebFaces+B.

The text does not report how many runs or seeds underlie those single-network comparisons.

The identity count was tested only up to 8192, so whether more identities help beyond that was not tested.

## Paper info

- **Authors**: Yi Sun, Xiaogang Wang, Xiaoou Tang
- **Venue**: arXiv · Preprint
- **First published**: 2014-6-18
- **Added**: 2026-11-12
- **Updated**: 2014-6-18
- **Version**: v1
- **arXiv**: 1406.4773
- **Category**: cs.CV
- **Original paper terms**: [arXiv non-exclusive 1.0](https://arxiv.org/licenses/nonexclusive-distrib/1.0/)
- **What we show**: Paper info and commentary

[Original paper ↗](https://arxiv.org/abs/1406.4773v1) · [PDF ↗](https://arxiv.org/pdf/1406.4773v1)

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

## Quote from the paper

Yi Sun, Xiaogang Wang, Xiaoou Tang (2014). Deep Learning Face Representation by Joint Identification-Verification. arXiv:1406.4773v1. https://arxiv.org/abs/1406.4773v1

**BibTeX**

```
@misc{sun2014deep,
  title = {{Deep Learning Face Representation by Joint Identification-Verification}},
  author = {Yi Sun and Xiaogang Wang and Xiaoou Tang},
  year = {2014},
  eprint = {1406.4773},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1406.4773v1}
}
```

## Related papers

- [A Tutorial on Principal Component Analysis](https://refivu.com/en/papers/6c1b9168-7aa0-40d4-97a5-859e8217739b-a-tutorial-on-principal-component-analysis.md)
- [Representation Learning on Graphs: Methods and Applications](https://refivu.com/en/papers/3ca2c648-5d7e-46c2-be1e-357cc66ab085-representation-learning-on-graphs-methods-and-applications.md)
- [Deep Transfer Learning with Joint Adaptation Networks](https://refivu.com/en/papers/a47a8c83-de4b-469b-a9c2-9df2e72bbd27-deep-transfer-learning-with-joint-adaptation-networks.md)
- [QT-Opt: Scalable Deep Reinforcement Learning for Vision-Based Robotic Manipulation](https://refivu.com/en/papers/7cb7d7d4-7a03-4f1d-bbc0-2ddaf1103d5a-qt-opt-scalable-deep-reinforcement-learning-for-vision.md)
- [WIDER FACE: A Face Detection Benchmark](https://refivu.com/en/papers/f25dbb8a-9814-427e-8059-2cad94728cee-wider-face-a-face-detection-benchmark.md)
- [GLUE: A Multi-Task Benchmark and Analysis Platform for Natural Language Understanding](https://refivu.com/en/papers/a5e0caad-afbf-4fa4-b072-f6f5cab0c916-glue-a-multi-task-benchmark-and-analysis-platform.md)

## Other paper commentary

- [Curiosity-driven Exploration by Self-supervised Prediction](https://refivu.com/en/papers/93936438-d2c7-4a12-b814-3073185546ca-curiosity-driven-exploration-by-self-supervised-prediction.md)
- [ConvNeXt V2: Co-designing and Scaling ConvNets with Masked Autoencoders](https://refivu.com/en/papers/d6599a02-0aa8-4eec-a1c3-2bdc45716f23-convnext-v2-co-designing-and-scaling-convnets-with.md)
- [Person Re-identification by Local Maximal Occurrence Representation and Metric Learning](https://refivu.com/en/papers/ce1c4e84-0a27-40a3-8d69-3dc923b2cf52-person-re-identification-by-local-maximal-occurrence.md)
- [UNITER: UNiversal Image-TExt Representation Learning](https://refivu.com/en/papers/c2b71a61-22ad-48f9-af71-922539fd9eab-uniter-universal-image-text-representation-learning.md)
- [Learning Face Representation from Scratch](https://refivu.com/en/papers/c66cea99-ee67-42f0-85f5-a773fc796f34-learning-face-representation-from-scratch.md)
- [Learning deep representations by mutual information estimation and maximization](https://refivu.com/en/papers/0ecc4e49-5a6d-49c7-a22d-0464db0ce259-learning-deep-representations-by-mutual-information.md)
- [Google's Multilingual Neural Machine Translation System: Enabling Zero-Shot Translation](https://refivu.com/en/papers/0924ecf7-d413-4972-9e1d-36ae4961169c-google-s-multilingual-neural-machine-translation-system.md)
- [Understanding Neural Networks Through Deep Visualization](https://refivu.com/en/papers/a476f0b3-a482-45fe-9135-826b92cf7a73-understanding-neural-networks-through-deep-visualization.md)
- [Dilated Residual Networks](https://refivu.com/en/papers/26273fe8-0291-4f6b-b987-719425d5caea-dilated-residual-networks.md)
- [An Empirical Study of Training Self-Supervised Vision Transformers](https://refivu.com/en/papers/a0c6f9f9-f1cc-461c-b80e-9c2d8a5e1c32-an-empirical-study-of-training-self-supervised-vision.md)
- [EAST: An Efficient and Accurate Scene Text Detector](https://refivu.com/en/papers/c3f94c0a-3560-4b29-930f-6e881b662882-east-an-efficient-and-accurate-scene-text-detector.md)
- [AI Fairness 360: An Extensible Toolkit for Detecting, Understanding, and Mitigating Unwanted Algorithmic Bias](https://refivu.com/en/papers/2f8b2e40-a990-42ac-bf4e-2865e4425590-ai-fairness-360-an-extensible-toolkit-for-detecting.md)

## Terms in this paper

- [Stochastic Gradient Descent](https://refivu.com/en/terms/a49650824022-stochastic-gradient-descent)
- [ReLU](https://refivu.com/en/terms/7b22f5612f6c-relu)
- [cosine similarity](https://refivu.com/en/terms/3baa01a8760d-cosine-similarity)
- [cross-entropy loss](https://refivu.com/en/terms/14067bdf8b9f-cross-entropy-loss)
- [PCA](https://refivu.com/en/terms/2f4628e32ef5-pca)
- [face recognition](https://refivu.com/en/terms/bb4e385ea93b-face-recognition)
- [LFW](https://refivu.com/en/terms/53d5ba8907e0-lfw)
- [ROC curve](https://refivu.com/en/terms/8a3e75b0a9ec-roc-curve)
- [softmax layer](https://refivu.com/en/terms/2ca3fbe341da-softmax-layer)
- [DeepID2](https://refivu.com/en/terms/e392bbcbc21d-deepid2)
- [LDA](https://refivu.com/en/terms/5db41ff3fa15-lda)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/1824448e-2edd-4d03-a6b5-1fbd92b71da3-deep-learning-face-representation-by-joint-identification)
