otx.algo.object_detection_3d.losses#

Loss functions for 3d object detection.

Classes

MonoDETRCriterion(num_classes, weight_dict, ...)

This class computes the loss for MonoDETR.

class otx.algo.object_detection_3d.losses.MonoDETRCriterion(num_classes: int, weight_dict: dict, focal_alpha: float, group_num: int = 11)[source]#

Bases: Module

This class computes the loss for MonoDETR.

MonoDETRCriterion.

Parameters:
  • num_classes (int) – number of object categories, omitting the special no-object category.

  • weight_dict (dict) – dict containing as key the names of the losses and as values their relative weight.

  • focal_alpha (float) – alpha in Focal Loss.

  • group_num (int) – number of groups for data parallelism.

forward(outputs: dict[str, Tensor], targets: list[dict[str, Tensor]]) dict[str, Tensor][source]#

This performs the loss computation.

Parameters:
  • outputs (dict) – dict of tensors, see the output specification of the model for the format.

  • targets (list) – list of dicts, such that len(targets) == batch_size. The expected keys in each dict depends on the losses applied, see each loss’ doc.

loss_3dcenter(outputs: dict, targets: list, indices: list, num_boxes: int) dict[str, Tensor][source]#

Compute the loss for the 3D center prediction.

Parameters:
  • outputs (dict) – dict of tensors, see the output specification of the model for the format.

  • targets (list) – list of dicts, such that len(targets) == batch_size. The expected keys in each dict depends on the losses applied, see each loss’ doc.

  • indices (list) – list of tuples, such that len(indices) == batch_size.

  • num_boxes (int) – number of boxes in the batch.

loss_angles(outputs: dict, targets: list, indices: list, num_boxes: int) dict[str, Tensor][source]#

Compute the loss for the angle prediction.

Parameters:
  • outputs (dict) – dict of tensors, see the output specification of the model for the format.

  • targets (list) – list of dicts, such that len(targets) == batch_size. The expected keys in each dict depends on the losses applied, see each loss’ doc.

  • indices (list) – list of tuples, such that len(indices) == batch_size.

  • num_boxes (int) – number of boxes in the batch.

loss_boxes(outputs: dict, targets: list, indices: list, num_boxes: int) dict[str, Tensor][source]#

Compute l1 loss.

Parameters:
  • outputs (dict) – dict of tensors, see the output specification of the model for the format.

  • targets (list) – list of dicts, such that len(targets) == batch_size. The expected keys in each dict depends on the losses applied, see each loss’ doc.

  • indices (list) – list of tuples, such that len(indices) == batch_size.

  • num_boxes (int) – number of boxes in the batch.

loss_depth_map(outputs: dict, targets: list, indices: list, num_boxes: int) dict[str, Tensor][source]#

Depth map loss.

Parameters:
  • outputs (dict) – dict of tensors, see the output specification of the model for the format.

  • targets (list) – list of dicts, such that len(targets) == batch_size. The expected keys in each dict depends on the losses applied, see each loss’ doc.

  • indices (list) – list of tuples, such that len(indices) == batch_size.

  • num_boxes (int) – number of boxes in the batch.

loss_depths(outputs: dict, targets: list, indices: list, num_boxes: int) dict[str, Tensor][source]#

Compute the loss for the depth prediction.

Parameters:
  • outputs (dict) – dict of tensors, see the output specification of the model for the format.

  • targets (list) – list of dicts, such that len(targets) == batch_size. The expected keys in each dict depends on the losses applied, see each loss’ doc.

  • indices (list) – list of tuples, such that len(indices) == batch_size.

  • num_boxes (int) – number of boxes in the batch

loss_dims(outputs: dict, targets: list, indices: list, num_boxes: int) dict[str, Tensor][source]#

Compute the loss for the dimension prediction.

Parameters:
  • outputs (dict) – dict of tensors, see the output specification of the model for the format.

  • targets (list) – list of dicts, such that len(targets) == batch_size. The expected keys in each dict depends on the losses applied, see each loss’ doc.

  • indices (list) – list of tuples, such that len(indices) == batch_size.

  • num_boxes (int) – number of boxes in the batch.

loss_giou(outputs: dict, targets: list, indices: list, num_boxes: int) dict[str, Tensor][source]#

Compute the GIoU loss.

Parameters:
  • outputs (dict) – dict of tensors, see the output specification of the model for the format.

  • targets (list) – list of dicts, such that len(targets) == batch_size. The expected keys in each dict depends on the losses applied, see each loss’ doc.

  • indices (list) – list of tuples, such that len(indices) == batch_size.

  • num_boxes (int) – number of boxes in the batch.

loss_labels(outputs: dict, targets: list, indices: list, num_boxes: int) dict[str, Tensor][source]#

Classification loss.

Parameters:
  • outputs (dict) – dict of tensors, see the output specification of the model for the format.

  • targets (list) – list of dicts, such that len(targets) == batch_size. The expected keys in each dict depends on the losses applied, see each loss’ doc.

  • indices (list) – list of tuples, such that len(indices) == batch_size.

  • num_boxes (int) – number of boxes in the batch.

property loss_map: dict[str, Callable]#

Return the loss map.