vis4d.op.loss.multi_pos_cross_entropy¶
Multi-positive cross entropy loss.
Functions
|
Calculate multi-positive cross-entropy loss. |
Classes
|
Multi-positive cross entropy loss. |
- class MultiPosCrossEntropyLoss(reducer=<function identity_loss>)[source]¶
Multi-positive cross entropy loss.
Used for appearance similiary learning in QDTrack.
Initialize a loss functor.
- Parameters:
reducer (LossReducer) – A function to aggregate the loss values into
prediction (a single tensor value. It is commonly used for dense)
loss. (tasks to merge pixel-wise loss to a final)
Example:: –
- def mean_loss(loss: torch.Tensor) -> torch.Tensor:
return loss.mean()
- forward(pred, target, weight, avg_factor)[source]¶
Multi-positive cross entropy loss.
- Parameters:
pred (Tensor) – Similarity scores before softmax. Shape [N, M]
target (Tensor) – Target for each pair. Either one, meaning same identity or zero, meaning different identity. Shape [N, M]
weight (Tensor) – The weight of loss for each prediction.
avg_factor (float) – Averaging factor for the loss.
- Returns:
Scalar loss value.
- Return type:
Tensor