Convert a rotated boxes in XYWHR format to XYXYR format. Args: boxes_xywhr (Tensor or np.ndarray): Rotated boxes in XYWHR format. Returns: Tensor or np.ndarray: Converted boxes in XYXYR format.
(
boxes_xywhr: Union[Tensor, np.ndarray])
| 184 | |
| 185 | @array_converter(apply_to=('boxes_xywhr', )) |
| 186 | def xywhr2xyxyr( |
| 187 | boxes_xywhr: Union[Tensor, np.ndarray]) -> Union[Tensor, np.ndarray]: |
| 188 | """Convert a rotated boxes in XYWHR format to XYXYR format. |
| 189 | |
| 190 | Args: |
| 191 | boxes_xywhr (Tensor or np.ndarray): Rotated boxes in XYWHR format. |
| 192 | |
| 193 | Returns: |
| 194 | Tensor or np.ndarray: Converted boxes in XYXYR format. |
| 195 | """ |
| 196 | boxes = torch.zeros_like(boxes_xywhr) |
| 197 | half_w = boxes_xywhr[..., 2] / 2 |
| 198 | half_h = boxes_xywhr[..., 3] / 2 |
| 199 | |
| 200 | boxes[..., 0] = boxes_xywhr[..., 0] - half_w |
| 201 | boxes[..., 1] = boxes_xywhr[..., 1] - half_h |
| 202 | boxes[..., 2] = boxes_xywhr[..., 0] + half_w |
| 203 | boxes[..., 3] = boxes_xywhr[..., 1] + half_h |
| 204 | boxes[..., 4] = boxes_xywhr[..., 4] |
| 205 | return boxes |
| 206 | |
| 207 | |
| 208 | def get_box_type(box_type: str) -> Tuple[type, int]: |
nothing calls this directly
no outgoing calls
no test coverage detected