Loss

class lightning_pose.losses.losses.Loss[source]

Bases: object

Parent class for all losses.

Attributes Summary

weight

Methods Summary

__call__(*args, **kwargs)

Call self as a function.

compute_loss(**kwargs)

log_loss(loss, stage)

rectify_epsilon(loss)

reduce_loss(loss[, method])

remove_nans(**kwargs)

Attributes Documentation

weight

Methods Documentation

__call__(*args, **kwargs)[source]

Call self as a function.

compute_loss(**kwargs)[source]
log_loss(loss: Tensor, stage: Literal['train', 'val', 'test']) list[dict][source]
rectify_epsilon(loss: Tensor) Tensor[source]
reduce_loss(loss: Tensor, method: str = 'mean') Tensor, {'__torchtyping__': True, 'details': ((),), 'cls_name': 'TensorType'}][source]
remove_nans(**kwargs)[source]
__init__(data_module: BaseDataModule | UnlabeledDataModule | None = None, epsilon: float | list[float] = 0.0, log_weight: float = 0.0, **kwargs) None[source]
Parameters:
  • data_module – give losses access to data for computing data-specific loss params

  • epsilon – loss values below epsilon will be zeroed out

  • log_weight – natural log of the weight in front of the loss term in the final objective function

__new__(**kwargs)