Shortcuts

API References

DATA

Dataloaders

SimilarityDataLoader

Special version of DataLoader which works with similarity samples.

PairsSimilarityDataLoader

DataLoader designed to work with data represented as SimilarityPairSample.

GroupSimilarityDataLoader

DataLoader designed to work with data represented as SimilarityGroupSample.

Datasets

SimilarityGroupDataset

Wrapper, which converts standard dataset of classification task into dataset, compatible with GroupSimilarityDataLoader.

Samples

SimilarityGroupSample

Represent groups of similar objects all of which should match with one-another within the group.

SimilarityPairSample

Represents a pair of objects, their similarity and relationship with other pairs.

DISTANCES

Cosine

Compute cosine similarities (and its interpretation as distances).

DotProduct

Compute dot product similarities (and its interpretation as distances).

Euclidean

Compute Euclidean distances (and its interpretation as similarities).

Manhattan

Compute Manhattan distances (and its interpretation as similarities).

EVAL

Counters

AttachedMetric

Attach batch-wise metric to TrainableModel

Evaluator

Calculate metrics on the whole datasets

Group metrics

GroupMetric

Base class for group metrics

RetrievalRPrecision

Compute the retrieval R-precision score for group based data

Pair metrics

PairMetric

Base class for metrics computation for pair based data

RetrievalPrecision

Calculates retrieval precision@k for pair based datasets

RetrievalReciprocalRank

Calculates retrieval reciprocal rank for pair based datasets

Samplers

GroupSampler

Perform selection of embeddings and targets for group based tasks.

PairSampler

Perform selection of embeddings and targets for pairs based tasks.

LOSSES

Base

GroupLoss

Base class for group losses.

PairwiseLoss

Base class for pairwise losses.

Implementations

ArcFaceLoss

Additive Angular Margin Loss as defined in https://arxiv.org/abs/1801.07698

ContrastiveLoss

Contrastive loss.

MultipleNegativesRankingLoss

Implement Multiple Negatives Ranking Loss as described in https://arxiv.org/pdf/1705.00652.pdf

SoftmaxLoss

Regular cross-entropy loss.

TripletLoss

Implements Triplet Loss as defined in https://arxiv.org/abs/1503.03832

CircleLoss

Implements Circle Loss as defined in https://arxiv.org/abs/2002.10857.

FastAPLoss

FastAP Loss

CosFaceLoss

Large Margin Cosine Loss as defined in https://arxiv.org/pdf/1801.09414.pdf

CenterLoss

Center Loss as defined in the paper "A Discriminative Feature Learning Approach for Deep Face Recognition" (http://ydwen.github.io/papers/WenECCV16.pdf) It aims to minimize the intra-class variations while keeping the features of different classes separable.

Extras

PytorchMetricLearningWrapper

Provide a simple wrapper to be able to use losses and miners from pytorch-metric-learning.

MAIN

Quaterion

Fine-tuning entry point

TRAIN

TrainableModel

TrainableModel

Base class for models to be trained.

Cache

CacheConfig

Determine cache settings.

CacheType

Available tensor devices to be used for caching.

UTILS

TrainStage

Handle train stage.

get_triplet_mask

Creates a 3D mask of valid triplets for the batch-all strategy.

get_anchor_positive_mask

Creates a 2D mask of valid anchor-positive pairs.

get_anchor_negative_mask

Creates a 2D mask of valid anchor-negative pairs.

Qdrant

Learn more about Qdrant vector search project and ecosystem

Discover Qdrant

Similarity Learning

Explore practical problem solving with Similarity Learning

Learn Similarity Learning

Community

Find people dealing with similar problems and get answers to your questions

Join Community