Skip to content

Commit 566b6b1

Browse files
committed
Revert "Fix non-rotated format to rotated format conversion logic (#8926)"
This reverts commit 77e95fc.
1 parent b1e9dfc commit 566b6b1

File tree

2 files changed

+1
-12
lines changed

2 files changed

+1
-12
lines changed

torchvision/transforms/v2/functional/_meta.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -263,24 +263,13 @@ def _xyxyxyxy_to_xywhr(xyxyxyxy: torch.Tensor, inplace: bool) -> torch.Tensor:
263263
return xyxyxyxy[..., :5].to(dtype)
264264

265265

266-
def is_rotated_bounding_box_format(format: BoundingBoxFormat) -> bool:
267-
return format.value in [
268-
BoundingBoxFormat.XYWHR.value,
269-
BoundingBoxFormat.CXCYWHR.value,
270-
BoundingBoxFormat.XYXYXYXY.value,
271-
]
272-
273-
274266
def _convert_bounding_box_format(
275267
bounding_boxes: torch.Tensor, old_format: BoundingBoxFormat, new_format: BoundingBoxFormat, inplace: bool = False
276268
) -> torch.Tensor:
277269

278270
if new_format == old_format:
279271
return bounding_boxes
280272

281-
if is_rotated_bounding_box_format(old_format) ^ is_rotated_bounding_box_format(new_format):
282-
raise ValueError("Cannot convert between rotated and unrotated bounding boxes.")
283-
284273
# TODO: Add _xywh_to_cxcywh and _cxcywh_to_xywh to improve performance
285274
if old_format == BoundingBoxFormat.XYWH:
286275
bounding_boxes = _xywh_to_xyxy(bounding_boxes, inplace)

torchvision/tv_tensors/_bounding_boxes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class BoundingBoxFormat(Enum):
2020
* ``XYWHR``: rotated boxes represented via corner, width and height, x1, y1
2121
being top left, w, h being width and height. r is rotation angle in
2222
degrees.
23-
* ``CXCYWHR``: rotated boxes represented via centre, width and height, cx,
23+
* ``CXCYWHR``: jrotated boxes represented via centre, width and height, cx,
2424
cy being center of box, w, h being width and height. r is rotation angle
2525
in degrees.
2626
* ``XYXYXYXY``: rotated boxes represented via corners, x1, y1 being top

0 commit comments

Comments
 (0)