vis4d.op.box.encoder.bevformer

NMS-Free bounding box coder for BEVFormer.

Classes

NMSFreeDecoder(num_classes, post_center_range)

BBox decoder for NMS-free detector.

class NMSFreeDecoder(num_classes, post_center_range, max_num=100, score_threshold=None)[source]

BBox decoder for NMS-free detector.

Initialize NMSFreeDecoder.

Parameters:
  • num_classes (int) – Number of classes.

  • post_center_range (list[float]) – Limit of the center.

  • max_num (int) – Max number to be kept. Default: 100.

  • score_threshold (float) – Threshold to filter boxes based on score. Default: None.

__call__(cls_scores, bbox_preds)[source]

Decode single batch bboxes.

Parameters:
  • cls_scores (Tensor) – Outputs from the classification head, in shape of [num_query, cls_out_channels]. Note cls_out_channels should includes background.

  • bbox_preds (Tensor) – Outputs from the regression head with normalized coordinate format (cx, cy, w, l, cz, h, rot_sine, rot_cosine, vx, vy). Shape [num_query, 9].

Returns:

Decoded boxes (x, y, z, l, w, h,

yaw, vx, vy), scores and labels.

Return type:

tuple[Tensor, Tensor, Tensor]