Replies: 6 comments 24 replies
-
先检测旋转框,然后对四边进行一次分类如果我想在 rotate-retinanet 上添加头部检测的功能,是不是只要在 retinanet 的头部新增一个头部的分类的编码就行? |
Beta Was this translation helpful? Give feedback.
-
我将 norm_angle 改成 如下,新增 angle_range == 'h180' 的情况,感觉写的不对,没有深刻理解 @qwert31639 , 虽然训练时跑起来了~ 感觉norm_angle写错了,虽然训练起来了 def norm_angle(angle, angle_range):
"""Limit the range of angles.
Args:
angle (ndarray): shape(n, ).
angle_range (Str): angle representations.
Returns:
angle (ndarray): shape(n, ).
"""
if angle_range == 'oc':
return angle
elif angle_range == 'le135':
return (angle + np.pi / 4) % np.pi - np.pi / 4
elif angle_range == 'le90':
return (angle + np.pi / 2) % np.pi - np.pi / 2
elif angle_range == 'h180':
return (angle + np.pi) % np.pi - np.pi
else:
print('Not yet implemented.') 使用了 projects/headet/structures/bbox/rotated_boxes.py#L24 mmrotate/structures/bbox/transforms.py#L22 python tools/train.py projects/headet/configs/rotated_retinanet/rotated-retinanet-rbox-h180_r50_fpn_1x_dota.py |
Beta Was this translation helpful? Give feedback.
-
角度预测出来之后,什么时候用到以下代码呢? @register_box_converter(RotatedBoxes, QuadriBoxes, force=True)
def rbox2qbox(boxes: Tensor) -> Tensor:
"""copy from mmrotate/structures/bbox/box_converters.py Convert rotated
boxes to quadrilateral boxes.
Args:
boxes (Tensor): Rotated box tensor with shape of (..., 5).
Returns:
Tensor: Quadrilateral box tensor with shape of (..., 8).
"""
centerx, centery, w, h, theta = torch.split(boxes, (1, 1, 1, 1, 1), dim=-1)
# cos_value, sin_value = torch.cos(theta), torch.sin(theta)
cosa = torch.cos(theta)
sina = torch.sin(theta)
wx, wy = w / 2 * cosa, w / 2 * sina
hx, hy = -h / 2 * sina, h / 2 * cosa
p1x, p1y = centerx - wx - hx, centery - wy - hy
p2x, p2y = centerx + wx - hx, centery + wy - hy
p3x, p3y = centerx + wx + hx, centery + wy + hy
p4x, p4y = centerx - wx + hx, centery - wy + hy
return torch.stack([p1x, p1y, p2x, p2y, p3x, p3y, p4x, p4y], dim=-1) |
Beta Was this translation helpful? Give feedback.
-
剛剛稍微改了一下(還沒寫unit test),大概是這樣 @register_box_converter(QuadriBoxes,RotatedBoxes, force=True)
def qbox2rbox(boxes: Tensor) -> Tensor:
"""Convert quadrilateral boxes to rotated boxes.
Args:
boxes (Tensor): Quadrilateral box tensor with shape of (..., 8).
Returns:
Tensor: Rotated box tensor with shape of (..., 5).
"""
points = boxes.cpu().numpy().reshape(-1, 4, 2)
cxs = points[...,0].mean()
cys = points[...,1].mean()
widthes= np.linalg.norm(points[:,1,:] - points[:,0,:])
heights= np.linalg.norm(points[:,2,:] - points[:,1,:])
thetas = np.arctan2((points[:,1,0]- points[:,2,0]),
(points[:,1,1]- points[:,2,1]))
thetas = np.where(thetas >= 0, np.pi - thetas, -(np.pi + thetas))
return torch.stack([cxs, cys, widthes, heights, thetas], dim=-1) |
Beta Was this translation helpful? Give feedback.
-
Is this still an open issue, or has anyone solved it? |
Beta Was this translation helpful? Give feedback.
-
请问这个问题解决了吗 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
如何在 MMRotate 中支持 360°的旋转目标检测?
How to support 360° rotate target detection in MMRotate?
背景动机
现有的 MMRotate 的算法检测出来的旋转框,无论是 OpenCV表示法还是长边表示法,表示的范围只有180°,不能区分旋转框的头部和尾部。而头部和尾部信息在现实生活中是非常重要,例如区分出遥感图像中车辆的头部和尾部,飞机的头部和尾部时极具价值的。所以希望能够在 MMRotate 中实现 360°的旋转目标检测。
相关论文
(以下论文来自 yangxue 大佬的推荐)
(比较推荐)根据头部定义框,框的角度定义范围就是0-360,然后iou、nms以及不同框的转换函数对应改一下就行(iou应该直接用都不用改),参考文献:
EAGLE: Large-Scale Vehicle Detection Dataset in Real-World Scenarios using Aerial Imagery
DRBox-v2: An improved detector with rotatable boxes for target detection in SAR images
先检测旋转框,然后对四边进行一次分类,分出头部所在的边,参考文献:
On the Arbitrary-Oriented Object Detection: Classification based Approaches Revisited
https://github.com/yanqingyao1994/QPDet
数据集约定
在本部分,如何编码头部信息比较好?
DOTA 格式(起点顺时针定义法)
强制约定A为物体的起始点,A、B、C和D点顺时针排布。此时边AB物体的头部,在DOTA格式的数据集中就不必要标出物体的头部了。
评测指标
在经典的mAP的基础,类别,iou>0.5,头部三个条件满足才算TP
旋转目标检测头部的可视化
此部分时实现旋转目标检测的头部的可视化~
Beta Was this translation helpful? Give feedback.
All reactions