matchclot.embedding.models module

Summary

Classes:

BatchSwapNoise

Swap Noise module

Encoder

Single modality encoder MLP with dropout and stochastic feature augmentation (SFA) https://openaccess.thecvf.com/content/ICCV2021/papers /Li_A_Simple_Feature_Augmentation_for_Domain_Generalization_ICCV_2021_paper.pdf

Modality_CLIP

CLIP-inspired architecture

Functions:

symmetric_npair_loss

CLIP loss

Reference

class BatchSwapNoise(p)[source]

Bases: Module

Swap Noise module

forward(x)[source]

Defines 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.

training: bool
class Encoder(n_input, embedding_size, dropout_rates, dims_layers, swap_noise_ratio, noise_amount=0.0)[source]

Bases: Module

Single modality encoder MLP with dropout and stochastic feature augmentation (SFA) https://openaccess.thecvf.com/content/ICCV2021/papers /Li_A_Simple_Feature_Augmentation_for_Domain_Generalization_ICCV_2021_paper.pdf

forward(x)[source]

Defines 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.

training: bool
class Modality_CLIP(Encoder, layers_dims, dropout_rates, dim_mod1, dim_mod2, output_dim, T, swap_rate_1=0.0, swap_rate_2=0.0, noise_amount=0.0)[source]

Bases: Module

CLIP-inspired architecture

forward(features_first, features_second)[source]

Defines 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.

training: bool
symmetric_npair_loss(logits, targets)[source]

CLIP loss