[docs]classMatchResult(NamedTuple):"""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} """assigned_gt_indices:torch.Tensorassigned_gt_iou:torch.Tensorassigned_labels:torch.Tensor
[docs]classMatcher(nn.Module):"""Base class for box / target matchers."""
[docs]@abc.abstractmethoddefforward(self,boxes:torch.Tensor,targets:torch.Tensor)->MatchResult:"""Match bounding boxes according to their struct."""raiseNotImplementedError
[docs]def__call__(self,boxes:torch.Tensor,targets:torch.Tensor)->MatchResult:"""Type declaration for forward."""returnself._call_impl(boxes,targets)