KevinMusgrave / pytorch-metric-learning

The easiest way to use deep metric learning in your application. Modular, flexible, and extensible. Written in PyTorch.
https://kevinmusgrave.github.io/pytorch-metric-learning/
MIT License
6.02k stars 658 forks source link

Utility for finding the best threshold? #733

Open ir2718 opened 18 hours ago

ir2718 commented 18 hours ago

Hi,

I would like to use an ONNX optimized version of a model trained using your library. However, for the use case of one-shot classification I need to determine a threshold for classification. Are there any utility functions which can calculate the optimal threshold based on a validation set, and a metric that I want to optimize for?

KevinMusgrave commented 16 hours ago

No there isn't a utility function for that. I guess you mean optimal distance for some k-nn based classification?