vis4d.op.box.matchers¶
Matchers package.
- class MatchResult(assigned_gt_indices: Tensor, assigned_gt_iou: Tensor, assigned_labels: Tensor)[source]¶
Match result class. Stores expected result tensors.
assigned_gt_indices: torch.Tensor - Tensor of [0, M) where M = num gt assigned_gt_iou: torch.Tensor - Tensor with IoU to assigned GT assigned_labels: torch.Tensor - Tensor of {0, -1, 1} = {neg, ignore, pos}
Create new instance of MatchResult(assigned_gt_indices, assigned_gt_iou, assigned_labels)
-
assigned_gt_indices:
Tensor
¶ Alias for field number 0
-
assigned_gt_iou:
Tensor
¶ Alias for field number 1
-
assigned_labels:
Tensor
¶ Alias for field number 2
-
assigned_gt_indices:
- class Matcher(*args, **kwargs)[source]¶
Base class for box / target matchers.
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- class MaxIoUMatcher(thresholds, labels, allow_low_quality_matches, min_positive_iou=0.0)[source]¶
MaxIoUMatcher class.
Creates an instance of the class.
- 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:
- 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:
Modules
Matchers. |
|
Match predictions and targets according to maximum 2D IoU. |
|
SimOTA label assigner. |