KevinMusgrave/pytorch-metric-learning

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

72
/ 100
Verified

Provides 9 independent modules—including loss functions (TripletMarginLoss, ArcFaceLoss, etc.), hard pair miners, distance metrics, and reducers—that compose into customizable training pipelines. Automatically converts between triplet and pair representations, supports self-supervised learning via augmentation pairs, and includes built-in trainers and evaluation utilities for metric learning workflows. Integrates seamlessly with standard PyTorch training loops and includes pre-built dataset loaders for common benchmarks like CUB-200 and Stanford Online Products.

6,312 stars and 5,671,502 monthly downloads. Used by 5 other packages. No commits in the last 6 months. Available on PyPI.

Stale 6m
Maintenance 2 / 25
Adoption 25 / 25
Maturity 25 / 25
Community 20 / 25

How are scores calculated?

Stars

6,312

Forks

663

Language

Python

License

MIT

Last pushed

Aug 17, 2025

Monthly downloads

5,671,502

Commits (30d)

0

Dependencies

4

Reverse dependents

5

Get this data via API

curl "https://pt-edge.onrender.com/api/v1/quality/ml-frameworks/KevinMusgrave/pytorch-metric-learning"

Open to everyone — 100 requests/day, no key needed. Get a free key for 1,000/day.