Shortcuts

CrossEntropyLoss

class mmpretrain.models.losses.CrossEntropyLoss(use_sigmoid=False, use_soft=False, reduction='mean', loss_weight=1.0, class_weight=None, pos_weight=None)[源代码]

Cross entropy loss.

参数:
  • use_sigmoid (bool) – Whether the prediction uses sigmoid of softmax. Defaults to False.

  • use_soft (bool) – Whether to use the soft version of CrossEntropyLoss. Defaults to False.

  • reduction (str) – The method used to reduce the loss. Options are “none”, “mean” and “sum”. Defaults to ‘mean’.

  • loss_weight (float) – Weight of the loss. Defaults to 1.0.

  • class_weight (List[float], optional) – The weight for each class with shape (C), C is the number of classes. Default None.

  • pos_weight (List[float], optional) – The positive weight for each class with shape (C), C is the number of classes. Only enabled in BCE loss when use_sigmoid is True. Default None.

Read the Docs v: latest
Versions
latest
stable
mmcls-1.x
mmcls-0.x
dev
Downloads
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.