vis4d.op.box.encoder

Init box coder module.

class DeltaXYWHBBoxDecoder(target_means=(0.0, 0.0, 0.0, 0.0), target_stds=(1.0, 1.0, 1.0, 1.0), wh_ratio_clip=0.016)[source]

Delta XYWH BBox decoder.

Following the practice in R-CNN, it decodes delta (dx, dy, dw, dh) back to original bbox (x1, y1, x2, y2).

Creates an instance of the class.

Parameters:
  • target_means (tuple, optional) – Denormalizing means of target for delta coordinates. Defaults to (0.0, 0.0, 0.0, 0.0).

  • target_stds (tuple, optional) – Denormalizing standard deviation of target for delta coordinates. Defaults to (1.0, 1.0, 1.0, 1.0).

  • wh_ratio_clip (float, optional) – Maximum aspect ratio for boxes. Defaults to 16/1000.

__call__(boxes, box_deltas)[source]

Apply box offset energies box_deltas to boxes.

Parameters:
  • boxes (Tensor) – Basic boxes. Shape (B, N, 4) or (N, 4)

  • box_deltas (Tensor) – Encoded offsets with respect to each roi. Has shape (B, N, num_classes * 4) or (B, N, 4) or (N, num_classes * 4) or (N, 4). Note N = num_anchors * W * H when rois is a grid of anchors.Offset encoding follows [1]_.

Returns:

Decoded boxes.

Return type:

Tensor

class DeltaXYWHBBoxEncoder(target_means=(0.0, 0.0, 0.0, 0.0), target_stds=(1.0, 1.0, 1.0, 1.0))[source]

Delta XYWH BBox encoder.

Following the practice in R-CNN, it encodes bbox (x1, y1, x2, y2) into delta (dx, dy, dw, dh).

Creates an instance of the class.

Parameters:
  • target_means (tuple, optional) – Denormalizing means of target for delta coordinates. Defaults to (0.0, 0.0, 0.0, 0.0).

  • target_stds (tuple, optional) – Denormalizing standard deviation of target for delta coordinates. Defaults to (1.0, 1.0, 1.0, 1.0).

__call__(boxes, targets)[source]

Get box regression transformation deltas.

Used to transform target boxes into target regression parameters.

Parameters:
  • boxes (Tensor) – Source boxes, e.g., object proposals.

  • targets (Tensor) – Target of the transformation, e.g., ground-truth boxes.

Returns:

Box transformation deltas

Return type:

Tensor

class QD3DTBox3DDecoder(center_scale=10.0, depth_log_scale=2.0, dim_log_scale=2.0, num_rotation_bins=2)[source]

3D bounding box decoder based on qd_3dt.

Creates an instance of the class.

__call__(boxes_2d, boxes_deltas, intrinsics)[source]

Decode the predicted boxes_deltas according to given 2D boxes.

Return type:

Tensor

class YOLOXBBoxDecoder[source]

YOLOX BBox decoder.

__call__(points, offsets)[source]

Apply box offsets to points, used by YOLOX.

Parameters:
  • points (Tensor) – Points. Shape (B, N, 4) or (N, 4).

  • offsets (Tensor) – Offsets. Has shape (B, N, 4) or (N, 4).

Returns:

Decoded boxes.

Return type:

Tensor

Modules

vis4d.op.box.encoder.bevformer

NMS-Free bounding box coder for BEVFormer.

vis4d.op.box.encoder.delta_xywh

XYWH Delta coder for 2D boxes.

vis4d.op.box.encoder.qd_3dt

3D bounding box coder.

vis4d.op.box.encoder.yolox

YOLOX decoder for 2D boxes.