loss

The loss config group determines all loss functions that are used for mml models. It determines a single loss function per task type. More precisely the TaskType is matched to a short string via CONFIG_ROUTES. For each model head (that matches a task type) the respective loss.SHORT_STRING config is instantiated. The main file determines some additional behaviour:

default

The default top level configuration.

auto_activate_weighing
default: true
  • automatically activates class weighing in case balanced sampling is turned off

  • see get_criteria()

class_weights
default: null
  • provide weight option to loss criterion directly

  • incompatible with sampling.balanced and loss.auto_activate_weighing

  • see get_criteria()

The following task type matching subdirectories exist:

cls

For classification tasks, currently shipped with a single option

ce

_target_
default: CrossEntropyLoss
  • pytorch cross entropy loss

mlcls

For multi-label classification tasks, currently shipped with two options

bce

_target_
default: BCEWithLogitsLoss
  • pytorch binary cross entropy loss

ce

_target_
default: CrossEntropyLoss
  • pytorch cross entropy loss

reg

For regression tasks, currently shipped with a single option

huber

_target_
default: HuberLoss
  • pytorch huber loss

delta
default: 1.0

seg

For segmentation tasks, currently shipped with two options

ce

_target_
default: HuberLoss
  • pytorch huber loss

ignore_index
default: 255
label_smoothing
default: 0.0
  • allows for label smoothing if activated

dice

_target_
default: DiceLoss
  • segmentation models pytorch dice loss

  • see source code

mode
default: multiclass
  • loss mode ‘binary’, ‘multiclass’ or ‘multilabel’

ignore_index
default: 255
  • mml ignores the index 255 by default in segmentation