deeplabcut.pose_estimation_pytorch.models.criterions.weighted
Classes:
| Name | Description |
|---|---|
WeightedBCECriterion |
Weighted Binary Cross Entropy (BCE) Loss. |
WeightedCriterion |
Base class for weighted criterions. |
WeightedHuberCriterion |
Weighted Huber Loss. |
WeightedMSECriterion |
Weighted Mean Squared Error (MSE) Loss. |
WeightedBCECriterion
Bases: WeightedCriterion
Weighted Binary Cross Entropy (BCE) Loss.
This loss computes the Binary Cross Entropy loss between the prediction and target tensors, but it also incorporates weights to adjust the contribution of each element in the loss calculation. The loss is computed element-wise, and elements with a weight of 0 are excluded from the loss calculation.
Source code in deeplabcut/pose_estimation_pytorch/models/criterions/weighted.py
WeightedCriterion
Bases: BaseCriterion
Base class for weighted criterions.
Methods:
| Name | Description |
|---|---|
forward |
Args: |
Source code in deeplabcut/pose_estimation_pytorch/models/criterions/weighted.py
forward
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Tensor
|
predicted tensor |
required |
|
Tensor
|
target tensor |
required |
|
Tensor | float
|
weights for each element in the loss calculation. If a float, weights all elements by that value. Defaults to 1. |
1.0
|
Returns:
| Type | Description |
|---|---|
Tensor
|
the weighted loss |
Source code in deeplabcut/pose_estimation_pytorch/models/criterions/weighted.py
WeightedHuberCriterion
Bases: WeightedCriterion
Weighted Huber Loss.
This loss computes the Huber loss between the prediction and target tensors, but it also incorporates weights to adjust the contribution of each element in the loss calculation. The loss is computed element-wise, and elements with a weight of 0 are excluded from the loss calculation.
Source code in deeplabcut/pose_estimation_pytorch/models/criterions/weighted.py
WeightedMSECriterion
Bases: WeightedCriterion
Weighted Mean Squared Error (MSE) Loss.
This loss computes the Mean Squared Error between the prediction and target tensors, but it also incorporates weights to adjust the contribution of each element in the loss calculation. The loss is computed element-wise, and elements with a weight of 0 (masked items) are excluded from the loss calculation.
Methods:
| Name | Description |
|---|---|
forward |
Args: |
Source code in deeplabcut/pose_estimation_pytorch/models/criterions/weighted.py
forward
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Tensor
|
predicted tensor |
required |
|
Tensor
|
target tensor |
required |
|
Tensor | float
|
weights for each element in the loss calculation. If a float, weights all elements by that value. Defaults to 1. |
1.0
|
Returns:
| Type | Description |
|---|---|
Tensor
|
the weighted loss |