RegressionMSELoss
- class lightning_pose.losses.losses.RegressionMSELoss[source]
Bases:
LossMSE loss between ground truth and predicted coordinates.
Attributes Summary
Methods Summary
__call__(keypoints_targ, keypoints_pred[, stage])Call self as a function.
compute_loss(targets, predictions)remove_nans(targets, predictions)Attributes Documentation
- loss_name = 'regression'
Methods Documentation
- __call__(keypoints_targ: Tensor, {'__torchtyping__': True, 'details': ('batch', 'two_x_num_keypoints'), 'cls_name': 'TensorType'}], keypoints_pred: Tensor, {'__torchtyping__': True, 'details': ('batch', 'two_x_num_keypoints'), 'cls_name': 'TensorType'}], stage: Literal['train', 'val', 'test'] | None = None, **kwargs) tuple[~torch.Annotated[~torch.Tensor, {'__torchtyping__': True, 'details': ((),), 'cls_name': 'TensorType'}], list[dict]][source]
Call self as a function.
- compute_loss(targets: Tensor, {'__torchtyping__': True, 'details': ('batch_x_two_x_num_keypoints',), 'cls_name': 'TensorType'}], predictions: Tensor, {'__torchtyping__': True, 'details': ('batch_x_two_x_num_keypoints',), 'cls_name': 'TensorType'}]) Tensor, {'__torchtyping__': True, 'details': ('batch_x_two_x_num_keypoints',), 'cls_name': 'TensorType'}][source]
- remove_nans(targets: Tensor, {'__torchtyping__': True, 'details': ('batch', 'two_x_num_keypoints'), 'cls_name': 'TensorType'}], predictions: Tensor, {'__torchtyping__': True, 'details': ('batch', 'two_x_num_keypoints'), 'cls_name': 'TensorType'}]) tuple[~torch.Annotated[~torch.Tensor, {'__torchtyping__': True, 'details': ('num_valid_keypoints',), 'cls_name': 'TensorType'}], ~torch.Annotated[~torch.Tensor, {'__torchtyping__': True, 'details': ('num_valid_keypoints',), 'cls_name': 'TensorType'}]][source]
- __init__(data_module: BaseDataModule | UnlabeledDataModule | None = None, epsilon: float = 0.0, log_weight: float = 0.0, **kwargs) None[source]
Initialize RegressionMSELoss.
- Parameters:
data_module – data module providing access to datasets; passed to the parent class.
epsilon – loss values below this threshold are zeroed out.
log_weight – final weight in front of the loss term in the objective function is computed as
1.0 / (2.0 * exp(log_weight)).
- __new__(**kwargs)