#129 · Primary category: Deep Learning Frameworks

pytorch-metric-learning

computer-vision contrastive-learning deep-learning deep-metric-learning embeddings image-retrieval machine-learning metric-learning pytorch self-supervised-learning

The easiest way to use deep metric learning in your application. Modular, flexible, and extensible. Written in PyTorch.

Project last updated:08/17/25

GitHub Stars

6.3K

Forks

658

Contributors

45

License

MIT

Why we included this project

Learning to tell similar items apart is the task behind face verification, product recognition, person re-identification, and image retrieval, and this library supplies the standard machinery for it without tying you to a new framework. Its triplet and pair-based losses, hard-pair miners, distance functions, and reducers are modular components that drop into an existing PyTorch training loop. You can start with a plain TripletMarginLoss and swap in cosine distances, threshold reducers, or regularizers one at a time as your needs change. Self-supervised setups and a cross-batch memory queue for MoCo-style training are covered too, and the repo ships trainers, testers, and an accuracy calculator for a complete workflow. Teams already comfortable in PyTorch get a practical way to build embedding models without reimplementing triplet mining themselves.

Articles for this project

No articles for this project yet.

To suggest a topic or contribute an article, contact us.

Related projects in this category