vis4d.op.loss.iou_loss

Embedding distance loss.

Functions

iou_loss(pred, target[, reducer, mode, eps])

Compute IoU loss.

Classes

IoULoss([reducer, mode, eps])

IoU loss.

class IoULoss(reducer=<function identity_loss>, mode='log', eps=1e-06)[source]

IoU loss.

Computing the IoU loss between a set of predicted bboxes and target bboxes. The loss is calculated depending on the mode:

  • linear: 1 - IoU

  • square: 1 - IoU^2

  • log: -log(IoU)

Parameters:
  • reducer (LossReducer) – Reducer to reduce the loss value. Defaults to identy_loss, which is no reduction.

  • mode (str, optional) – Mode to calculate the loss. Defaults to “log”.

  • eps (float, optional) – Epsilon value to avoid division by zero.

Creates an instance of the class.

forward(pred, target)[source]

Forward function.

Parameters:
  • pred (torch.Tensor) – Predicted bboxes.

  • target (torch.Tensor) – Target bboxes.

Returns:

The reduced IoU loss.

Return type:

torch.Tensor

iou_loss(pred, target, reducer=<function identity_loss>, mode='log', eps=1e-06)[source]

Compute IoU loss.

Parameters:
  • pred (torch.Tensor) – Predicted bboxes.

  • target (torch.Tensor) – Target bboxes.

  • reducer (LossReducer) – Reducer to reduce the loss value. Defaults to identy_loss, which is no reduction.

  • mode (str, optional) – Mode to calculate the loss. Defaults to “log”.

  • eps (float, optional) – Epsilon value to avoid division by zero.

Returns:

The reduced IoU loss.

Return type:

torch.Tensor