Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Support TOOD: Task-aligned One-stage Object Detection (ICCV 2021 Oral) #6746

Merged
merged 18 commits into from
Dec 24, 2021
Prev Previous commit
Next Next commit
clean assigner
  • Loading branch information
RangiLyu committed Dec 22, 2021
commit 5b85d89440591d8c455c06d978d85a197e3f70e4
19 changes: 1 addition & 18 deletions mmdet/core/bbox/assigners/task_aligned_assigner.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,9 @@ class TaskAlignedAssigner(BaseAssigner):
topk (float): number of bbox selected in each level
"""

def __init__(self,
topk,
iou_calculator=dict(type='BboxOverlaps2D'),
ignore_iof_thr=-1):
def __init__(self, topk, iou_calculator=dict(type='BboxOverlaps2D')):
self.topk = topk
self.iou_calculator = build_iou_calculator(iou_calculator)
self.ignore_iof_thr = ignore_iof_thr

def anchor_center(self, anchors):
"""Get anchor centers from anchors.

Args:
anchors (Tensor): Anchor list with shape (N, 4), "xyxy" format.

Returns:
Tensor: Anchor centers with shape (N, 2), "xy" format.
"""
anchors_cx = (anchors[:, 2] + anchors[:, 0]) / 2
anchors_cy = (anchors[:, 3] + anchors[:, 1]) / 2
return torch.stack([anchors_cx, anchors_cy], dim=-1)

def assign(self,
scores,
Expand Down