opr.losses package

Module for losses.

opr.losses.batch_hard_contrastive

Multimodal contrastive loss implementation.

Code adopted from repository: https://github.com/jac99/MinkLocMultimodal, MIT License

class opr.losses.batch_hard_contrastive.BatchHardContrastiveLoss(pos_margin: float = 0.2, neg_margin: float = 0.2)[source]

Bases: Module

Contrastive loss with batch hard triplet miner.

Code adopted from repository: https://github.com/jac99/MinkLocMultimodal, MIT License

forward(embeddings: Tensor, positives_mask: Tensor, negatives_mask: Tensor) Tuple[Tensor, Dict[str, float]][source]

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

opr.losses.batch_hard_triplet_margin

Multimodal triplet margin loss implementation.

Code adopted from repository: https://github.com/jac99/MinkLocMultimodal, MIT License

class opr.losses.batch_hard_triplet_margin.BatchHardTripletMarginLoss(margin: float = 0.2)[source]

Bases: Module

Triplet margin loss with batch hard triplet miner.

Code adopted from repository: https://github.com/jac99/MinkLocMultimodal, MIT License

forward(embeddings: Tensor, positives_mask: Tensor, negatives_mask: Tensor) Tuple[Tensor, Dict[str, float]][source]

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

opr.losses.truncated_smooth_ap