Skip to content

Latest commit

 

History

History
34 lines (25 loc) · 5.32 KB

README.md

File metadata and controls

34 lines (25 loc) · 5.32 KB

Examples on Google Colab

Before running the notebooks, make sure that the runtime type is set to "GPU", by going to the Runtime menu, and clicking on "Change runtime type".

Click "Open in playground" on the Colab header to interact with the notebook.

Simple examples

Notebook Description Colab Link
MNIST using TripletMarginLoss Train with TripletMarginLoss, evaluate with AccuracyCalculator. Open In Colab
MNIST using SubCenterArcFaceLoss Train with SubCenterArcFaceLoss, view outlier samples. Open In Colab
MoCo on CIFAR10 Self-supervision using MoCo with CrossBatchMemory Open In Colab
Multiprocessing with DistributedDataParallel An example using pytorch_metric_learning.utils.distributed Open In Colab

Training/testing workflows with logging and model saving

The following notebooks are meant to show entire training/testing workflows. (If you want to use just a loss or miner in your own code, see the notebooks above.) They generally go through the following steps:

  • initialize models, optimizers, and transforms
  • creates train/validation splits
  • initialize a loss, miner, sampler, trainer, and tester
  • train the model, record accuracy, and plot the embedding space
Notebook Description Colab Link
MetricLossOnly Use just a metric loss. Open In Colab
A scRNAseq Metric Embedding An example using canonical single-cell RNAseq cell types. Open In Colab
TrainWithClassifier Use a metric loss + classification loss and network. Open In Colab
CascadedEmbeddings Use multiple sub-networks and mine their outputs. Open In Colab
DeepAdversarialMetricLearning Use a generator to create hard negatives during training. Open In Colab
TwoStreamMetricLoss For use with two-stream datasets, where anchors and positives/negatives come from different sources. Open In Colab
Inference Use the inference module after you're done training. Open In Colab