TemporalLoss
- class lightning_pose.losses.losses.TemporalLoss[source]
Bases:
LossPenalize temporal differences for each target.
Motion model: x_t = x_(t-1) + e_t, e_t ~ N(0, s)
Methods Summary
__call__(keypoints_pred[, confidences, stage])Call self as a function.
compute_loss(predictions)rectify_epsilon(loss)Rectify supporting a list of epsilons, one per bodypart.
remove_nans(loss, confidences)Methods Documentation
- __call__(keypoints_pred: Tensor, {'__torchtyping__': True, 'details': ('batch', 'two_x_num_keypoints'), 'cls_name': 'TensorType'}], confidences: Tensor, {'__torchtyping__': True, 'details': ('batch', 'num_keypoints'), 'cls_name': 'TensorType'}] | None = None, stage: Literal['train', 'val', 'test'] | None = None, **kwargs) Tensor, {'__torchtyping__': True, 'details': ((),), 'cls_name': 'TensorType'}], list[dict]][source]
Call self as a function.
- compute_loss(predictions: Tensor, {'__torchtyping__': True, 'details': ('batch', 'two_x_num_keypoints'), 'cls_name': 'TensorType'}]) Tensor, {'__torchtyping__': True, 'details': ('batch_minus_one', 'num_keypoints',), 'cls_name': 'TensorType'}][source]
- rectify_epsilon(loss: Tensor, {'__torchtyping__': True, 'details': ('batch_minus_one', 'num_keypoints'), 'cls_name': 'TensorType'}]) Tensor, {'__torchtyping__': True, 'details': ('batch_minus_one', 'num_keypoints',), 'cls_name': 'TensorType'}][source]
Rectify supporting a list of epsilons, one per bodypart. Not implemented in Loss class, because shapes of broadcasting may vary
- remove_nans(loss: Tensor, {'__torchtyping__': True, 'details': ('batch_minus_one', 'num_keypoints'), 'cls_name': 'TensorType'}], confidences: Tensor, {'__torchtyping__': True, 'details': ('batch', 'num_keypoints'), 'cls_name': 'TensorType'}]) Tensor, {'__torchtyping__': True, 'details': ('batch_minus_one', 'num_keypoints',), 'cls_name': 'TensorType'}][source]
- __init__(data_module: BaseDataModule | UnlabeledDataModule | None = None, epsilon: float | list[float] = 0.0, prob_threshold: 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)