Rotated Object Detection
Rotated object detection predicts oriented boxes instead of axis-aligned boxes. It matters when angle is part of localization: aerial ships, text lines, shelves, industrial parts, and long objects where ordinary object detection boxes include too much background.
Oriented boxes and rotated IoU
An oriented rectangle can be parameterized as
Here is the box center, and are width and height, and is the rotation angle under the dataset’s convention. This parameterization is compact, but the convention must be explicit because several parameter tuples can represent the same physical rectangle.
or by four corner points. Evaluation uses the same matching as detection and segmentation metrics, but IoU is polygon overlap rather than axis-aligned rectangle overlap:
The sets and are the predicted and reference rotated boxes interpreted as polygons. The numerator is their shared area; the denominator is the total area covered by either box.
Angle conventions matter because , , and swapped width/height can describe the same physical box.
Worked example
The code rasterizes two oriented rectangles onto a fine grid and approximates rotated IoU by counting overlapping grid cells. It is useful here because it makes angle error visible without requiring a geometry library.
import numpy as np
def rect_mask(cx, cy, w, h, theta, grid=80):
yy, xx = np.mgrid[0:grid, 0:grid] + 0.5
x = (xx / grid * 6) - 3
y = (yy / grid * 6) - 3
c, s = np.cos(theta), np.sin(theta)
xr = c * (x - cx) + s * (y - cy)
yr = -s * (x - cx) + c * (y - cy)
return (np.abs(xr) <= w/2) & (np.abs(yr) <= h/2)
m0 = rect_mask(0, 0, 3, 1, 0)
m1 = rect_mask(0, 0, 3, 1, np.deg2rad(30))
m2 = rect_mask(.2, 0, 3, 1, np.deg2rad(30))
print("axis_vs_30deg_iou", round(np.logical_and(m0,m1).sum() / np.logical_or(m0,m1).sum(), 3))
print("aligned_shifted_iou", round(np.logical_and(m1,m2).sum() / np.logical_or(m1,m2).sum(), 3))Observed output:
axis_vs_30deg_iou 0.481
aligned_shifted_iou 0.739The same elongated box at 0 and 30 degrees has IoU 0.481, below common 0.5 matching thresholds. Two boxes with the same 30-degree orientation but a small center shift still reach 0.739 IoU, so angle error can matter more than modest translation error for elongated objects.
Caveats
Angle discontinuities near the convention boundary can destabilize training. Symmetric objects may have ambiguous orientation labels. For text, OCR pipelines may care more about line reading order than box IoU alone.
References
- DOTA: A Large-scale Dataset for Object Detection in Aerial Images
- Faster R-CNN: Towards Real-Time Object Detection with Region Proposal Networks
Nav