mindspore.ops.rotated_iou
- mindspore.ops.rotated_iou(boxes, query_boxes, trans=False, mode=0, is_cross=True, v_threshold=0.0, e_threshold=0.0)[source]
Calculate the overlap area between rotated rectangles.
Warning
This is an experimental API that is subject to change or deletion.
Note
The input data types supported by the Ascend platform include bfloat16, float16, float32.
- Parameters
boxes (Tensor) – The first set of rectangles which has a shape of \((B, N, 5)\).
query_boxes (Tensor) – The second set of rectangles which has a shape of \((B, K, 5)\).
trans (bool) – Distinguish the rectangles representations of boxes and query_boxes. If
True
, the format of boxes and query_boxes is'xyxyt'
, else the format is'xywht'
. The default value isFalse
.mode (int) – Distinguish the calculation mode. If the value is
1
, the calculation mode is'iof'
, else the calculation mode is'iou'
. The default value is0
.is_cross (bool) – If
True
, use cross-calculation, else use one-to-one calculation. The default value isTrue
.v_threshold (float) – Provide condition relaxation for intersection calculation. The default value is
0.0
.e_threshold (float) – Provide condition relaxation for intersection calculation. The default value is
0.0
.
- Returns
Tensor, the shape is \((B, N, K)\).
- Raises
TypeError – If boxes is not a Tensor.
TypeError – If query_boxes is not a Tensor.
ValueError – If boxes and query_boxes do not has same first dim.
ValueError – If the third dimension of boxes or query_boxes is not
5
.
- Supported Platforms:
Ascend
Examples
>>> import mindspore >>> import numpy as np >>> from mindspore import Tensor, ops >>> a = np.random.uniform(0,1,(2,2,5)).astype(np.float16) >>> b = np.random.uniform(0,1,(2,3,5)).astype(np.float16) >>> box1 = Tensor(a) >>> box2 = Tensor(b) >>> output = ops.rotated_iou(box1, box2, trans=False, mode=0, is_cross=True)