vis4d.op.box.matchers.sim_ota

SimOTA label assigner.

Modified from mmdetection (https://github.com/open-mmlab/mmdetection).

Classes

SimOTAMatcher([center_radius, ...])

SimOTA label assigner used by YOLOX.

class SimOTAMatcher(center_radius=2.5, candidate_topk=10, iou_weight=3.0, cls_weight=1.0)[source]

SimOTA label assigner used by YOLOX.

Parameters:
  • center_radius (float, optional) – Ground truth center size to judge whether a prior is in center. Defaults to 2.5.

  • candidate_topk (int, optional) – The candidate top-k which used to get top-k ious to calculate dynamic-k. Defaults to 10.

  • iou_weight (float, optional) – The scale factor for regression iou cost. Defaults to 3.0.

  • cls_weight (float, optional) – The scale factor for classification cost. Defaults to 1.0.

Init.

__call__(pred_scores, priors, decoded_bboxes, gt_bboxes, gt_labels)[source]

Type declaration for forward.

Return type:

MatchResult

dynamic_k_matching(cost, pairwise_ious, num_gt, valid_mask)[source]

Dynamic K matching strategy.

Return type:

tuple[Tensor, Tensor]

forward(pred_scores, priors, decoded_bboxes, gt_bboxes, gt_labels)[source]

Assign gt to priors using SimOTA.

Parameters:
  • pred_scores (Tensor) – Classification scores of one image, a 2D-Tensor with shape [num_priors, num_classes]

  • priors (Tensor) – All priors of one image, a 2D-Tensor with shape [num_priors, 4] in [cx, xy, stride_w, stride_y] format.

  • decoded_bboxes (Tensor) – Predicted bboxes, a 2D-Tensor with shape [num_priors, 4] in [tl_x, tl_y, br_x, br_y] format.

  • gt_bboxes (Tensor) – Ground truth bboxes of one image, a 2D-Tensor with shape [num_gts, 4] in [tl_x, tl_y, br_x, br_y] format.

  • gt_labels (Tensor) – Ground truth labels of one image, a Tensor with shape [num_gts].

Returns:

The assigned result.

Return type:

MatchResult

get_in_gt_and_in_center_info(priors, gt_bboxes)[source]

Get whether the priors are in gt bboxes and in centers.

Return type:

tuple[Tensor, Tensor]