Source-linked AI summary

Deep Cosine Metric Learning for Person Re-Identification

Nicolai Wojke, Alex Bewley

arXiv:1812.00442v1cs.CVcs.LG

TL;DR

Person re-identification needs embeddings that match identities across nuisance variations and support unseen individuals, while direct metric learning can require sophisticated sampling. The paper re-parameterizes softmax to optimize cosine similarity in the embedding, then evaluates the resulting nearest-neighbor representation on two re-identification datasets, where it achieves the best results among the authors’ networks and modest test gains. The evaluation remains limited to one application and a single lightweight CNN architecture.

  • Problem

    Person re-identification requires a feature representation that is invariant to nuisance conditions and supports nearest-neighbor matching of identities unseen during training.

  • Method

    The paper re-parameterizes the softmax classifier so cross-entropy training directly enforces cosine similarity in the representation space.

  • Results

    The cosine softmax network achieved the best results among the authors’ networks on Market 1501 and MARS, with mAP gains of 3.64 and 2.58, respectively, over the softmax-loss comparison.

  • Takeaways & Limitations

    The classifier can be removed after training, enabling nearest-neighbor search for unseen identities without sophisticated pair or triplet sampling strategies.

  • Takeaways & Limitations

    Evaluation was limited to a specific application using a single lightweight CNN architecture, requiring validation on more datasets, domains, and larger or pretrained architectures.

Abstract

from arXiv · show

Metric learning aims to construct an embedding where two extracted features corresponding to the same identity are likely to be closer than features from different identities. This paper presents a method for learning such a feature space where the cosine similarity is effectively optimized through a simple re-parametrization of the conventional softmax classification regime. At test time, the final classification layer can be stripped from the network to facilitate nearest neighbor queries on unseen individuals using the cosine similarity metric. This approach presents a simple alternative to direct metric learning objectives such as siamese networks that have required sophisticated pair or triplet sampling strategies in the past. The method is evaluated on two large-scale pedestrian re-identification datasets where competitive results are achieved overall. In particular, we achieve better generalization on the test set compared to a network trained with triplet loss.

1. Introduction

Person re-identification searches gallery images for the same person despite pose, lighting, and background changes. The paper unifies metric learning and classification through a re-parameterized softmax classifier for nearest-neighbor search on unseen identities.

  • Person re-identification must handle pose, lighting, and background variation across cameras and time while matching identities unseen during training.
  • Larger Market 1501 and MARS datasets expanded the labeled data available for person re-identification.
  • The field debates direct metric-learning objectives against classification-based training followed by nearest-neighbor queries on learned representations.
  • The proposed method re-parameterizes softmax so metric learning is encoded directly in classification and the embedding generalizes to unseen identities at test time.

2. Related Work

Related work contrasts direct metric-learning losses with classification-based approaches and hybrid objectives. Siamese methods can succeed but often depend on difficult sampling and optimization choices.

  • Contrastive and triplet losses directly encode similarity by pulling same-class samples together and separating different-class samples.
  • Successful siamese metric learning has long depended on intelligent pair or triplet sampling, making development complex and time consuming.
  • Hard margins in contrastive and triplet losses create nonsmooth objectives that are harder to optimize across batches.
  • Magnet loss operates on entire class distributions, while center loss combines softmax with a class-compactness penalty.
  • Person re-identification research includes CNN architectures specialized for pose and viewpoint variation, while baseline CNNs can also compete with specialized counterparts.

3. Standard Softmax Classifier

Standard softmax processes CNN features into class probabilities and trains them with cross-entropy. However, joint encoder training primarily pushes samples from decision boundaries rather than toward class means, weakening metric structure in the representation.

  • A CNN maps each input image to a feature representation r, which a softmax classifier converts into probabilities for C training classes.
  • The standard classifier directly learns conditional class probabilities rather than estimating Gaussian class-conditional densities and priors.
  • Cross-entropy training makes the estimated probability near 1 for the correct class and near 0 for other classes.
  • Joint encoder training pushes samples away from decision boundaries but not necessarily toward class means, so identity similarity is encoded in boundary orientation rather than the feature representation.
  • The standard softmax behavior is problematic for metric learning because separating classes does not ensure a useful distance structure in feature space.

4. Cosine Softmax Classifier

The cosine softmax classifier re-parameterizes softmax by normalizing representations and class weights, while using κ to control conditional-probability shape and embedding compactness.

  • Cosine Softmax Classifier: Unit-length representations and normalized class weights make the classifier’s log-probabilities directly proportional to cosine similarity.The encoder output satisfies ∥fΘ(x)∥2 = 1, and each class weight is normalized to unit length.
  • Cosine Softmax Classifier: The classifier removes bias terms and separates weight-vector direction from the free scaling parameter κ.This gives C −1 fewer parameters than the standard formulation while retaining a similar functional form.
  • Cosine Softmax Classifier: Under equal class priors and shared concentration, the classifier probabilities also correspond to a von Mises-Fisher posterior on the unit sphere.The vMF density peaks around each normalized class mean direction and decreases as cosine similarity decreases.
  • Cosine Softmax Classifier: Cross-entropy pushes examples away from decision boundaries toward parametrized class mean directions, making each normalized weight a surrogate for its class samples.The scaling parameter κ controls the shape of the conditional class probabilities.
  • Cosine Softmax Classifier: Low κ produces smoother, wider-support probabilities and tighter sample clusters, whereas high κ produces box-like probabilities that permit freer within-class movement.Figure 3 illustrates this behavior in a one-dimensional problem with three classes.

5. Evaluation

The evaluation compares cosine softmax with direct metric-learning objectives and existing re-identification systems on Market 1501 and MARS. Cosine softmax achieves the strongest results among the paper’s networks while using a relatively shallow, computationally efficient architecture.

  • The evaluation compares training behavior and validation error against triplet and magnet losses, then measures overall performance against existing systems.
  • Network Architecture: The network extracts 128-dimensional features from 128 × 64 RGB images and applies final ℓ2 normalization before cosine softmax classification.
  • Compared Objectives: The triplet baseline uses a soft-margin loss with GPU-generated triplets, while the magnet baseline uses a unimodal class-distribution formulation computed per batch.
  • Training Behavior: 84.92% rank 1 matching rate is the best validation result for cosine softmax on MARS, exceeding soft-margin triplet loss at 83.23% and magnet loss at 77.34%.The best results occur at iterations 49,760, 86,329, and 47,677, respectively.
  • Re-Identification Performance: The cosine softmax network achieves the best results among the paper’s networks on both datasets, with mAP gains of 3.64 on Market 1501 and 2.58 on MARS.These correspond to relative gains of 6.8% and 4.7%, respectively.
  • Re-Identification Performance: The proposed architecture approaches higher-capacity systems while using roughly a tenth of TriNet’s parameters, providing a trade-off between computational efficiency and re-identification performance.The best competing method exceeds cosine softmax by 15.84 mAP points on Market 1501 and 10.82 on MARS, while a scratch-trained LuNet is only 4.03 and 3.6 points higher, including test-time augmentation.

6. Conclusion

The approach enforces cosine similarity through softmax re-parametrization, then removes the classifier for nearest-neighbor queries on unseen identities. The conclusion also reports failure-case and embedding visualizations while limiting evaluation to one lightweight CNN application.

  • Cosine softmax re-parametrization enforces cosine similarity and permits nearest-neighbor queries on unseen identities after removing the classifier.
  • Figure 5 presents challenging Market 1501 gallery queries with their five most similar and dissimilar images, exposing representative failure cases.
  • Figure 6 visualizes an excerpt of the learned embedding on the MARS test split using t-SNE.
  • Evaluation was limited to a specific application using a single lightweight CNN architecture, motivating validation on more datasets, domains, and larger models.
Loading 1812.00442v1…