otx.algo.classification.losses#

Backbone modules for OTX custom model.

Classes

AsymmetricAngularLossWithIgnore([gamma_pos, ...])

Asymmetric angular loss.

class otx.algo.classification.losses.AsymmetricAngularLossWithIgnore(gamma_pos: float = 0.0, gamma_neg: float = 1.0, k: float = 0.8, clip: float = 0.05, reduction: str = 'sum', loss_weight: float = 1.0)[source]#

Bases: Module

Asymmetric angular loss.

Parameters:
  • 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 1.0.

  • k (float) – positive balance parameter. Defaults to 0.8.

  • clip (float) – 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.

Init fuction of AsymmetricAngularLossWithIgnore class.

forward(pred: Tensor, target: Tensor, valid_label_mask: Tensor | None = None, weight: Tensor | None = None, avg_factor: float | None = None, reduction_override: str | None = None) Tensor[source]#

Asymmetric angular loss.