You are reading the documentation for MMClassification 0.x, which will soon be deprecated at the end of 2022. We recommend you upgrade to MMClassification 1.0 to enjoy fruitful new features and better performance brought by OpenMMLab 2.0. Check the installation tutorial, migration tutorial and changelog for more details.
- class mmcls.models.AsymmetricLoss(gamma_pos=0.0, gamma_neg=4.0, clip=0.05, reduction='mean', loss_weight=1.0, use_sigmoid=True, eps=1e-08)¶
gamma_pos (float) – positive focusing parameter. Defaults to 0.0.
gamma_neg (float) – Negative focusing parameter. We usually set gamma_neg > gamma_pos. Defaults to 4.0.
clip (float, optional) – Probability margin. Defaults to 0.05.
reduction (str) – The method used to reduce the loss into a scalar.
loss_weight (float) – Weight of loss. Defaults to 1.0.
use_sigmoid (bool) – Whether the prediction uses sigmoid instead of softmax. Defaults to True.
eps (float) – The minimum value of the argument of logarithm. Defaults to 1e-8.
- forward(pred, target, weight=None, avg_factor=None, reduction_override=None)¶
pred (torch.Tensor) – The prediction with shape (N, *).
target (torch.Tensor) – The ground truth label of the prediction with shape (N, *), N or (N,1).
weight (torch.Tensor, optional) – Sample-wise loss weight with shape (N, *). Defaults to None.
avg_factor (int, optional) – Average factor that is used to average the loss. Defaults to None.
reduction_override (str, optional) – The method used to reduce the loss into a scalar. Options are “none”, “mean” and “sum”. Defaults to None.
- Return type