Replies: 2 comments 1 reply
-
对比以下两个的文件可以发现,hbox 和 qbox 最大的区别只是 assigner中的iou_calculator从RBboxOverlaps2D变成了FakeRBboxOverlaps2D _base_ = './rotated-retinanet-rbox-le90_r50_fpn_1x_dota.py'
model = dict(
train_cfg=dict(
assigner=dict(iou_calculator=dict(type='FakeRBboxOverlaps2D'))))
train_pipeline = [
dict(
type='mmdet.LoadImageFromFile',
file_client_args={{_base_.file_client_args}}),
dict(type='mmdet.LoadAnnotations', with_bbox=True, box_type='qbox'),
dict(type='ConvertBoxType', box_type_mapping=dict(gt_bboxes='rbox')),
dict(type='mmdet.Resize', scale=(1024, 1024), keep_ratio=True),
dict(type='mmdet.RandomFlip', prob=0.5),
dict(type='mmdet.PackDetInputs')
]
train_dataloader = dict(dataset=dict(pipeline=train_pipeline)) |
Beta Was this translation helpful? Give feedback.
0 replies
-
从以下代码段中的 Calculate IoU between 2D minimum circumscribed hbbs of rbbs 这句话,搞懂了 hbox 在 config 中的意思,是训练的时候计算iou是通过求最小外接水平矩形,然后两个水平矩形再求iou。 @TASK_UTILS.register_module()
class FakeRBboxOverlaps2D(object):
"""2D Overlaps Calculator for Minimum Circumscribed Horizental Bboxes of
Rotated Bboxes."""
def __call__(self,
bboxes1: RotatedBoxes,
bboxes2: RotatedBoxes,
mode: str = 'iou',
is_aligned: bool = False) -> Tensor:
"""Calculate IoU between 2D minimum circumscribed hbbs of rbbs.
Args:
bboxes1 (:obj:`RotatedBoxes` or Tensor): bboxes have shape (m, 5)
in <cx, cy, w, h, t> format, shape (m, 6) in
<cx, cy, w, h, t, score> format.
bboxes2 (:obj:`RotatedBoxes` or Tensor): bboxes have shape (n, 5)
in <cx, cy, w, h, t> format, shape (n, 6) in
<cx, cy, w, h, t, score> format, or be empty.
mode (str): 'iou' (intersection over union), 'iof' (intersection
over foreground).
is_aligned (bool): If True, then m and n must be equal.
Defaults to False.
Returns:
Tensor: shape (m, n) if ``is_aligned `` is False else shape (m,)
"""
assert bboxes1.size(-1) in [0, 5, 6]
assert bboxes2.size(-1) in [0, 5, 6]
if bboxes1.size(-1) == 6:
bboxes1 = bboxes1[..., :5]
if bboxes2.size(-1) == 6:
bboxes2 = bboxes2[..., :5]
if not isinstance(bboxes1, RotatedBoxes):
bboxes1 = RotatedBoxes(bboxes1)
if not isinstance(bboxes2, RotatedBoxes):
bboxes2 = RotatedBoxes(bboxes2)
return fake_rbbox_overlaps(bboxes1, bboxes2, mode, is_aligned)
def __repr__(self) -> str:
"""str: a string describing the module"""
repr_str = self.__class__.__name__ + '()'
return repr_str |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
mmrotate的config中的 hbox 、rbox和qbox是什么意思?有什么区别吗?
What does hbox mean?
Beta Was this translation helpful? Give feedback.
All reactions