vis4d.op.detect3d.qd_3dt

QD-3DT detector.

Functions

get_default_box_codec([center_scale, ...])

Get the default bounding box encoder and decoder.

get_default_box_matcher()

Get default box matcher of QD-3DT bounding box 3D head.

get_default_box_sampler()

Get default box sampler of QD-3DT bounding box 3D head.

get_default_proposal_pooler()

Get default proposal pooler of QD-3DT bounding box 3D head.

Classes

Box3DUncertaintyLoss([reducer, ...])

Box3d loss for QD-3DT.

QD3DTBBox3DHead(num_classes[, ...])

This class implements the QD-3DT bounding box 3D head.

QD3DTBBox3DHeadOutput(predictions, targets, ...)

QD-3DT bounding box 3D head training output.

QD3DTDet3DOut(boxes_3d, depth_uncertainty)

Output of QD-3DT bounding box 3D head.

RoI2Det3D([box_decoder])

Post processing for QD3DTBBox3DHead.

class Box3DUncertaintyLoss(reducer=<function mean_loss>, center_loss_weight=1.0, depth_loss_weight=1.0, dimension_loss_weight=1.0, rotation_loss_weight=1.0, uncertainty_loss_weight=1.0, num_rotation_bins=2)[source]

Box3d loss for QD-3DT.

Creates an instance of the class.

Parameters:
  • reducer (LossReducer) – Reducer for the loss function.

  • center_loss_weight (float) – Weight for center loss.

  • depth_loss_weight (float) – Weight for depth loss.

  • dimension_loss_weight (float) – Weight for dimension loss.

  • rotation_loss_weight (float) – Weight for rotation loss.

  • uncertainty_loss_weight (float) – Weight for uncertainty loss.

  • num_rotation_bins (int) – Number of rotation bins.

forward(pred, target, labels)[source]

Compute box3d loss.

Parameters:
  • pred (Tensor) – Box predictions of shape [N, num_classes, 6 + 3 * num_rotations_bins].

  • target (torcch.Tensor) – Target boxes of shape [N, 6 + num_rotation_bins].

  • labels (Tensor) – Target Labels of shape [N].

Return type:

Dict[str, Tensor]

Returns:

dict[str, Tensor] containing ‘delta 2dc’, ‘dimension’, ‘depth’,

’rotation’ and ‘uncertainty’ loss.

class QD3DTBBox3DHead(num_classes, proposal_pooler=None, box_matcher=None, box_sampler=None, box_encoder=None, proposal_append_gt=True, num_shared_convs=2, num_shared_fcs=0, num_dep_convs=4, num_dep_fcs=0, num_dim_convs=4, num_dim_fcs=0, num_rot_convs=4, num_rot_fcs=0, num_cen_2d_convs=4, num_cen_2d_fcs=0, in_channels=256, conv_out_dim=256, fc_out_dim=1024, roi_feat_size=7, conv_has_bias=True, norm=None, num_groups=32, num_rotation_bins=2, start_level=2)[source]

This class implements the QD-3DT bounding box 3D head.

Initialize the QD-3DT bounding box 3D head.

__call__(features, det_boxes, intrinsics=None, target_boxes=None, target_boxes3d=None, target_class_ids=None)[source]

Type definition.

Return type:

QD3DTBBox3DHeadOutput

forward(features, det_boxes, intrinsics=None, target_boxes=None, target_boxes3d=None, target_class_ids=None)[source]

Forward.

Return type:

QD3DTBBox3DHeadOutput

get_embeds(feat)[source]

Generate embedding from bbox feature.

Return type:

tuple[Tensor, Tensor, Tensor, Tensor]

get_outputs(x_dep, x_dim, x_rot, x_cen_2d)[source]

Generate output 3D bounding box parameters.

Return type:

Tensor

get_predictions(features, boxes_2d)[source]

Get 3D bounding box prediction parameters.

Return type:

list[Tensor]

get_targets(pos_assigned_gt_inds, target_boxes, target_boxes3d, target_class_ids, intrinsics)[source]

Get 3D bounding box targets for training.

Return type:

tuple[Tensor, Tensor]

class QD3DTBBox3DHeadOutput(predictions: list[Tensor], targets: Tensor | None, labels: Tensor | None)[source]

QD-3DT bounding box 3D head training output.

Create new instance of QD3DTBBox3DHeadOutput(predictions, targets, labels)

labels: Tensor | None

Alias for field number 2

predictions: list[Tensor]

Alias for field number 0

targets: Tensor | None

Alias for field number 1

class QD3DTDet3DOut(boxes_3d: list[Tensor], depth_uncertainty: list[Tensor])[source]

Output of QD-3DT bounding box 3D head.

boxes_3d

Predicted 3D bounding boxes. Each tensor has shape (N, 12) and contains x,y,z,h,w,l,rx,ry,rz,vx,vy,vz.

Type:

list[Tensor]

depth_uncertainty

Predicted depth uncertainty. Each tensor has shape (N, 1).

Type:

list[Tensor]

Create new instance of QD3DTDet3DOut(boxes_3d, depth_uncertainty)

boxes_3d: list[Tensor]

Alias for field number 0

depth_uncertainty: list[Tensor]

Alias for field number 1

class RoI2Det3D(box_decoder=None)[source]

Post processing for QD3DTBBox3DHead.

Initialize.

__call__(predictions, boxes_2d, class_ids, intrinsics)[source]

Forward pass during testing stage.

Parameters:
  • predictions (list[Tensor]) – Predictions.

  • boxes_2d (list[Tensor]) – 2D boxes.

  • class_ids (list[Tensor]) – Class IDs.

  • intrinsics (Tensor) – Camera intrinsics.

Returns:

QD3DT 3D detection output.

Return type:

QD3DTDet3DOut

get_default_box_codec(center_scale=10.0, depth_log_scale=2.0, dim_log_scale=2.0, num_rotation_bins=2, bin_overlap=0.16666666666666666)[source]

Get the default bounding box encoder and decoder.

Return type:

tuple[QD3DTBox3DEncoder, QD3DTBox3DDecoder]

get_default_box_matcher()[source]

Get default box matcher of QD-3DT bounding box 3D head.

Return type:

MaxIoUMatcher

get_default_box_sampler()[source]

Get default box sampler of QD-3DT bounding box 3D head.

Return type:

CombinedSampler

get_default_proposal_pooler()[source]

Get default proposal pooler of QD-3DT bounding box 3D head.

Return type:

RoIPooler