Modules
Li-ArcFace
- class torchflare.modules.LiArcFace(*args: Any, **kwargs: Any)[source]
Implementation of Li-ArcFace.
- Parameters
in_features – Size of the input features
out_features – The size of output features(usually number of num_classes)
s – The norm for input features.
m – margin
- forward(features: torch.Tensor, targets: Optional[torch.Tensor] = None) torch.Tensor [source]
Forward Pass.
- Parameters
features – The input features of shape (BS x F) where BS is batch size and F is input feature dimension.
targets – The targets with shape BS , where BS is batch size
- Returns
Logits with shape (BS x out_features)
Additive Margin Softmax
- class torchflare.modules.AMSoftmax(*args: Any, **kwargs: Any)[source]
Implementation of Additive Margin Softmax.
- Parameters
in_features – Size of the input features
out_features – The size of output features(usually number of num_classes)
s – The norm for input features.
m – margin
- forward(features: torch.Tensor, targets: Optional[torch.Tensor] = None) torch.Tensor [source]
Forward Pass.
- Parameters
features – The input features of shape (BS x F) where BS is batch size and F is input feature dimension.
targets – The targets with shape BS , where BS is batch size
- Returns
Logits with shape (BS x out_features)
ArcFace
- class torchflare.modules.ArcFace(*args: Any, **kwargs: Any)[source]
Implementation of ‘ArcFace Loss <https://arxiv.org/abs/1801.07698>`_.
- Parameters
in_features – Size of the input features
out_features – The size of output features(usually number of num_classes)
s – The norm for input features.
m – margin
- forward(features: torch.Tensor, targets: Optional[torch.Tensor] = None) torch.Tensor [source]
Forward Pass.
- Parameters
features – The input features of shape (BS x F) where BS is batch size and F is input feature dimension.
targets – The targets with shape BS , where BS is batch size
- Returns
Logits with shape (BS x out_features)
CosFace
- class torchflare.modules.CosFace(*args: Any, **kwargs: Any)[source]
Implementation of CosFace Loss.
- Parameters
in_features – Size of the input features
out_features – The size of output features(usually number of num_classes)
s – The norm for input features.
m – margin
- forward(features: torch.Tensor, targets: Optional[torch.Tensor] = None) torch.Tensor [source]
Forward Pass.
- Parameters
features – The input features of shape (BS x F) where BS is batch size and F is input feature dimension.
targets – The targets with shape BS , where BS is batch size
- Returns
Logits with shape (BS x out_features)
Squeeze and Excitation - CSE
- class torchflare.modules.CSE(*args: Any, **kwargs: Any)[source]
Implementation of Channel Wise Squeeze and Excitation Block.
Paper : https://arxiv.org/abs/1709.01507
Adapted from https://www.kaggle.com/c/tgs-salt-identification-challenge/discussion/65939 and https://www.kaggle.com/c/tgs-salt-identification-challenge/discussion/66178
Squeeze and Excitation - SSE
- class torchflare.modules.SSE(*args: Any, **kwargs: Any)[source]
SSE : Channel Squeeze and Spatial Excitation block.
Paper : https://arxiv.org/abs/1803.02579
Adapted from https://www.kaggle.com/c/tgs-salt-identification-challenge/discussion/66178
Squeeze and Excitation - SCSE
- class torchflare.modules.SCSE(*args: Any, **kwargs: Any)[source]
Implementation of SCSE : Concurrent Spatial and Channel Squeeze and Channel Excitation block.
Paper : https://arxiv.org/abs/1803.02579
Adapted from https://www.kaggle.com/c/tgs-salt-identification-challenge/discussion/66178