Skip to content

Commit d434a1e

Browse files
authored
Revert rotated bboxes (#9000)
1 parent b1e9dfc commit d434a1e

File tree

7 files changed

+60
-412
lines changed

7 files changed

+60
-412
lines changed

test/common_utils.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,6 @@ def sample_position(values, max_value):
423423
h, w = [torch.randint(1, s, (num_boxes,)) for s in canvas_size]
424424
y = sample_position(h, canvas_size[0])
425425
x = sample_position(w, canvas_size[1])
426-
r = -360 * torch.rand((num_boxes,)) + 180
427426

428427
if format is tv_tensors.BoundingBoxFormat.XYWH:
429428
parts = (x, y, w, h)
@@ -436,23 +435,6 @@ def sample_position(values, max_value):
436435
cx = x + w / 2
437436
cy = y + h / 2
438437
parts = (cx, cy, w, h)
439-
elif format is tv_tensors.BoundingBoxFormat.XYWHR:
440-
parts = (x, y, w, h, r)
441-
elif format is tv_tensors.BoundingBoxFormat.CXCYWHR:
442-
cx = x + w / 2
443-
cy = y + h / 2
444-
parts = (cx, cy, w, h, r)
445-
elif format is tv_tensors.BoundingBoxFormat.XYXYXYXY:
446-
r_rad = r * torch.pi / 180.0
447-
cos, sin = torch.cos(r_rad), torch.sin(r_rad)
448-
x1, y1 = x, y
449-
x3 = x1 + w * cos
450-
y3 = y1 - w * sin
451-
x2 = x3 + h * sin
452-
y2 = y3 + h * cos
453-
x4 = x1 + h * sin
454-
y4 = y1 + h * cos
455-
parts = (x1, y1, x3, y3, x2, y2, x4, y4)
456438
else:
457439
raise ValueError(f"Format {format} is not supported")
458440

test/test_ops.py

Lines changed: 2 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,61 +1339,8 @@ def test_bbox_xywh_cxcywh(self):
13391339
box_xywh = ops.box_convert(box_cxcywh, in_fmt="cxcywh", out_fmt="xywh")
13401340
assert_equal(box_xywh, box_tensor)
13411341

1342-
def test_bbox_xywhr_cxcywhr(self):
1343-
box_tensor = torch.tensor(
1344-
[
1345-
[0, 0, 100, 100, 0],
1346-
[0, 0, 0, 0, 0],
1347-
[10, 15, 20, 20, 0],
1348-
[23, 35, 70, 60, 0],
1349-
[4, 2, 4, 2, 0],
1350-
[5, 5, 4, 2, 90],
1351-
[8, 4, 4, 2, 180],
1352-
[7, 1, 4, 2, -90],
1353-
],
1354-
dtype=torch.float,
1355-
)
1356-
1357-
exp_cxcywhr = torch.tensor(
1358-
[
1359-
[50, 50, 100, 100, 0],
1360-
[0, 0, 0, 0, 0],
1361-
[20, 25, 20, 20, 0],
1362-
[58, 65, 70, 60, 0],
1363-
[6, 3, 4, 2, 0],
1364-
[6, 3, 4, 2, 90],
1365-
[6, 3, 4, 2, 180],
1366-
[6, 3, 4, 2, -90],
1367-
],
1368-
dtype=torch.float,
1369-
)
1370-
1371-
assert exp_cxcywhr.size() == torch.Size([8, 5])
1372-
box_cxcywhr = ops.box_convert(box_tensor, in_fmt="xywhr", out_fmt="cxcywhr")
1373-
torch.testing.assert_close(box_cxcywhr, exp_cxcywhr)
1374-
1375-
# Reverse conversion
1376-
box_xywhr = ops.box_convert(box_cxcywhr, in_fmt="cxcywhr", out_fmt="xywhr")
1377-
torch.testing.assert_close(box_xywhr, box_tensor)
1378-
1379-
def test_bbox_cxcywhr_to_xyxyxyxy(self):
1380-
box_tensor = torch.tensor([[5, 3, 4, 2, 90]], dtype=torch.float)
1381-
exp_xyxyxyxy = torch.tensor([[4, 5, 4, 1, 6, 1, 6, 5]], dtype=torch.float)
1382-
1383-
assert exp_xyxyxyxy.size() == torch.Size([1, 8])
1384-
box_xyxyxyxy = ops.box_convert(box_tensor, in_fmt="cxcywhr", out_fmt="xyxyxyxy")
1385-
torch.testing.assert_close(box_xyxyxyxy, exp_xyxyxyxy)
1386-
1387-
def test_bbox_xywhr_to_xyxyxyxy(self):
1388-
box_tensor = torch.tensor([[4, 5, 4, 2, 90]], dtype=torch.float)
1389-
exp_xyxyxyxy = torch.tensor([[4, 5, 4, 1, 6, 1, 6, 5]], dtype=torch.float)
1390-
1391-
assert exp_xyxyxyxy.size() == torch.Size([1, 8])
1392-
box_xyxyxyxy = ops.box_convert(box_tensor, in_fmt="xywhr", out_fmt="xyxyxyxy")
1393-
torch.testing.assert_close(box_xyxyxyxy, exp_xyxyxyxy)
1394-
1395-
@pytest.mark.parametrize("inv_infmt", ["xwyh", "cxwyh", "xwyhr", "cxwyhr", "xxxxyyyy"])
1396-
@pytest.mark.parametrize("inv_outfmt", ["xwcx", "xhwcy", "xwcxr", "xhwcyr", "xyxyxxyy"])
1342+
@pytest.mark.parametrize("inv_infmt", ["xwyh", "cxwyh"])
1343+
@pytest.mark.parametrize("inv_outfmt", ["xwcx", "xhwcy"])
13971344
def test_bbox_invalid(self, inv_infmt, inv_outfmt):
13981345
box_tensor = torch.tensor(
13991346
[[0, 0, 100, 100], [0, 0, 0, 0], [10, 15, 20, 20], [23, 35, 70, 60]], dtype=torch.float

test/test_transforms_v2.py

Lines changed: 31 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,6 @@
5353
from torchvision.transforms.v2.functional._utils import _get_kernel, _register_kernel_internal
5454

5555

56-
# While we are working on adjusting transform functions
57-
# for rotated and oriented bounding boxes formats,
58-
# we limit the perimeter of tests to formats
59-
# for which transform functions are already implemented.
60-
# In the future, this global variable will be replaced with `list(tv_tensors.BoundingBoxFormat)`
61-
# to support all available formats.
62-
SUPPORTED_BOX_FORMATS = [tv_tensors.BoundingBoxFormat[x] for x in ["XYXY", "XYWH", "CXCYWH"]]
63-
NEW_BOX_FORMATS = [tv_tensors.BoundingBoxFormat[x] for x in ["XYWHR", "CXCYWHR", "XYXYXYXY"]]
64-
6556
# turns all warnings into errors for this module
6657
pytestmark = [pytest.mark.filterwarnings("error")]
6758

@@ -635,7 +626,7 @@ def test_kernel_image(self, size, interpolation, use_max_size, antialias, dtype,
635626
check_scripted_vs_eager=not isinstance(size, int),
636627
)
637628

638-
@pytest.mark.parametrize("format", SUPPORTED_BOX_FORMATS)
629+
@pytest.mark.parametrize("format", list(tv_tensors.BoundingBoxFormat))
639630
@pytest.mark.parametrize("size", OUTPUT_SIZES)
640631
@pytest.mark.parametrize("use_max_size", [True, False])
641632
@pytest.mark.parametrize("dtype", [torch.float32, torch.int64])
@@ -766,7 +757,7 @@ def _reference_resize_bounding_boxes(self, bounding_boxes, *, size, max_size=Non
766757
new_canvas_size=(new_height, new_width),
767758
)
768759

769-
@pytest.mark.parametrize("format", SUPPORTED_BOX_FORMATS)
760+
@pytest.mark.parametrize("format", list(tv_tensors.BoundingBoxFormat))
770761
@pytest.mark.parametrize("size", OUTPUT_SIZES)
771762
@pytest.mark.parametrize("use_max_size", [True, False])
772763
@pytest.mark.parametrize("fn", [F.resize, transform_cls_to_functional(transforms.Resize)])
@@ -1012,7 +1003,7 @@ class TestHorizontalFlip:
10121003
def test_kernel_image(self, dtype, device):
10131004
check_kernel(F.horizontal_flip_image, make_image(dtype=dtype, device=device))
10141005

1015-
@pytest.mark.parametrize("format", SUPPORTED_BOX_FORMATS)
1006+
@pytest.mark.parametrize("format", list(tv_tensors.BoundingBoxFormat))
10161007
@pytest.mark.parametrize("dtype", [torch.float32, torch.int64])
10171008
@pytest.mark.parametrize("device", cpu_and_cuda())
10181009
def test_kernel_bounding_boxes(self, format, dtype, device):
@@ -1081,7 +1072,7 @@ def _reference_horizontal_flip_bounding_boxes(self, bounding_boxes):
10811072

10821073
return reference_affine_bounding_boxes_helper(bounding_boxes, affine_matrix=affine_matrix)
10831074

1084-
@pytest.mark.parametrize("format", SUPPORTED_BOX_FORMATS)
1075+
@pytest.mark.parametrize("format", list(tv_tensors.BoundingBoxFormat))
10851076
@pytest.mark.parametrize(
10861077
"fn", [F.horizontal_flip, transform_cls_to_functional(transforms.RandomHorizontalFlip, p=1)]
10871078
)
@@ -1178,7 +1169,7 @@ def test_kernel_image(self, param, value, dtype, device):
11781169
shear=_EXHAUSTIVE_TYPE_AFFINE_KWARGS["shear"],
11791170
center=_EXHAUSTIVE_TYPE_AFFINE_KWARGS["center"],
11801171
)
1181-
@pytest.mark.parametrize("format", SUPPORTED_BOX_FORMATS)
1172+
@pytest.mark.parametrize("format", list(tv_tensors.BoundingBoxFormat))
11821173
@pytest.mark.parametrize("dtype", [torch.float32, torch.int64])
11831174
@pytest.mark.parametrize("device", cpu_and_cuda())
11841175
def test_kernel_bounding_boxes(self, param, value, format, dtype, device):
@@ -1327,7 +1318,7 @@ def _reference_affine_bounding_boxes(self, bounding_boxes, *, angle, translate,
13271318
),
13281319
)
13291320

1330-
@pytest.mark.parametrize("format", SUPPORTED_BOX_FORMATS)
1321+
@pytest.mark.parametrize("format", list(tv_tensors.BoundingBoxFormat))
13311322
@pytest.mark.parametrize("angle", _CORRECTNESS_AFFINE_KWARGS["angle"])
13321323
@pytest.mark.parametrize("translate", _CORRECTNESS_AFFINE_KWARGS["translate"])
13331324
@pytest.mark.parametrize("scale", _CORRECTNESS_AFFINE_KWARGS["scale"])
@@ -1355,7 +1346,7 @@ def test_functional_bounding_boxes_correctness(self, format, angle, translate, s
13551346

13561347
torch.testing.assert_close(actual, expected)
13571348

1358-
@pytest.mark.parametrize("format", SUPPORTED_BOX_FORMATS)
1349+
@pytest.mark.parametrize("format", list(tv_tensors.BoundingBoxFormat))
13591350
@pytest.mark.parametrize("center", _CORRECTNESS_AFFINE_KWARGS["center"])
13601351
@pytest.mark.parametrize("seed", list(range(5)))
13611352
def test_transform_bounding_boxes_correctness(self, format, center, seed):
@@ -1462,7 +1453,7 @@ class TestVerticalFlip:
14621453
def test_kernel_image(self, dtype, device):
14631454
check_kernel(F.vertical_flip_image, make_image(dtype=dtype, device=device))
14641455

1465-
@pytest.mark.parametrize("format", SUPPORTED_BOX_FORMATS)
1456+
@pytest.mark.parametrize("format", list(tv_tensors.BoundingBoxFormat))
14661457
@pytest.mark.parametrize("dtype", [torch.float32, torch.int64])
14671458
@pytest.mark.parametrize("device", cpu_and_cuda())
14681459
def test_kernel_bounding_boxes(self, format, dtype, device):
@@ -1529,7 +1520,7 @@ def _reference_vertical_flip_bounding_boxes(self, bounding_boxes):
15291520

15301521
return reference_affine_bounding_boxes_helper(bounding_boxes, affine_matrix=affine_matrix)
15311522

1532-
@pytest.mark.parametrize("format", SUPPORTED_BOX_FORMATS)
1523+
@pytest.mark.parametrize("format", list(tv_tensors.BoundingBoxFormat))
15331524
@pytest.mark.parametrize("fn", [F.vertical_flip, transform_cls_to_functional(transforms.RandomVerticalFlip, p=1)])
15341525
def test_bounding_boxes_correctness(self, format, fn):
15351526
bounding_boxes = make_bounding_boxes(format=format)
@@ -1598,7 +1589,7 @@ def test_kernel_image(self, param, value, dtype, device):
15981589
expand=[False, True],
15991590
center=_EXHAUSTIVE_TYPE_AFFINE_KWARGS["center"],
16001591
)
1601-
@pytest.mark.parametrize("format", SUPPORTED_BOX_FORMATS)
1592+
@pytest.mark.parametrize("format", list(tv_tensors.BoundingBoxFormat))
16021593
@pytest.mark.parametrize("dtype", [torch.float32, torch.uint8])
16031594
@pytest.mark.parametrize("device", cpu_and_cuda())
16041595
def test_kernel_bounding_boxes(self, param, value, format, dtype, device):
@@ -1769,7 +1760,7 @@ def _reference_rotate_bounding_boxes(self, bounding_boxes, *, angle, expand, cen
17691760
bounding_boxes
17701761
)
17711762

1772-
@pytest.mark.parametrize("format", SUPPORTED_BOX_FORMATS)
1763+
@pytest.mark.parametrize("format", list(tv_tensors.BoundingBoxFormat))
17731764
@pytest.mark.parametrize("angle", _CORRECTNESS_AFFINE_KWARGS["angle"])
17741765
@pytest.mark.parametrize("expand", [False, True])
17751766
@pytest.mark.parametrize("center", _CORRECTNESS_AFFINE_KWARGS["center"])
@@ -1782,7 +1773,7 @@ def test_functional_bounding_boxes_correctness(self, format, angle, expand, cent
17821773
torch.testing.assert_close(actual, expected)
17831774
torch.testing.assert_close(F.get_size(actual), F.get_size(expected), atol=2 if expand else 0, rtol=0)
17841775

1785-
@pytest.mark.parametrize("format", SUPPORTED_BOX_FORMATS)
1776+
@pytest.mark.parametrize("format", list(tv_tensors.BoundingBoxFormat))
17861777
@pytest.mark.parametrize("expand", [False, True])
17871778
@pytest.mark.parametrize("center", _CORRECTNESS_AFFINE_KWARGS["center"])
17881779
@pytest.mark.parametrize("seed", list(range(5)))
@@ -2703,7 +2694,7 @@ def test_kernel_image(self, param, value, dtype, device):
27032694
check_cuda_vs_cpu=dtype is not torch.float16,
27042695
)
27052696

2706-
@pytest.mark.parametrize("format", SUPPORTED_BOX_FORMATS)
2697+
@pytest.mark.parametrize("format", list(tv_tensors.BoundingBoxFormat))
27072698
@pytest.mark.parametrize("dtype", [torch.float32, torch.int64])
27082699
@pytest.mark.parametrize("device", cpu_and_cuda())
27092700
def test_kernel_bounding_boxes(self, format, dtype, device):
@@ -2830,7 +2821,7 @@ def test_kernel_image(self, kwargs, dtype, device):
28302821
check_kernel(F.crop_image, make_image(self.INPUT_SIZE, dtype=dtype, device=device), **kwargs)
28312822

28322823
@pytest.mark.parametrize("kwargs", CORRECTNESS_CROP_KWARGS)
2833-
@pytest.mark.parametrize("format", SUPPORTED_BOX_FORMATS)
2824+
@pytest.mark.parametrize("format", list(tv_tensors.BoundingBoxFormat))
28342825
@pytest.mark.parametrize("dtype", [torch.float32, torch.int64])
28352826
@pytest.mark.parametrize("device", cpu_and_cuda())
28362827
def test_kernel_bounding_box(self, kwargs, format, dtype, device):
@@ -2980,7 +2971,7 @@ def _reference_crop_bounding_boxes(self, bounding_boxes, *, top, left, height, w
29802971
)
29812972

29822973
@pytest.mark.parametrize("kwargs", CORRECTNESS_CROP_KWARGS)
2983-
@pytest.mark.parametrize("format", SUPPORTED_BOX_FORMATS)
2974+
@pytest.mark.parametrize("format", list(tv_tensors.BoundingBoxFormat))
29842975
@pytest.mark.parametrize("dtype", [torch.float32, torch.int64])
29852976
@pytest.mark.parametrize("device", cpu_and_cuda())
29862977
def test_functional_bounding_box_correctness(self, kwargs, format, dtype, device):
@@ -2993,7 +2984,7 @@ def test_functional_bounding_box_correctness(self, kwargs, format, dtype, device
29932984
assert_equal(F.get_size(actual), F.get_size(expected))
29942985

29952986
@pytest.mark.parametrize("output_size", [(17, 11), (11, 17), (11, 11)])
2996-
@pytest.mark.parametrize("format", SUPPORTED_BOX_FORMATS)
2987+
@pytest.mark.parametrize("format", list(tv_tensors.BoundingBoxFormat))
29972988
@pytest.mark.parametrize("dtype", [torch.float32, torch.int64])
29982989
@pytest.mark.parametrize("device", cpu_and_cuda())
29992990
@pytest.mark.parametrize("seed", list(range(5)))
@@ -3516,8 +3507,7 @@ def test_aug_mix_severity_error(self, severity):
35163507

35173508

35183509
class TestConvertBoundingBoxFormat:
3519-
old_new_formats = list(itertools.permutations(SUPPORTED_BOX_FORMATS, 2))
3520-
old_new_formats += list(itertools.permutations(NEW_BOX_FORMATS, 2))
3510+
old_new_formats = list(itertools.permutations(iter(tv_tensors.BoundingBoxFormat), 2))
35213511

35223512
@pytest.mark.parametrize(("old_format", "new_format"), old_new_formats)
35233513
def test_kernel(self, old_format, new_format):
@@ -3528,7 +3518,7 @@ def test_kernel(self, old_format, new_format):
35283518
old_format=old_format,
35293519
)
35303520

3531-
@pytest.mark.parametrize("format", SUPPORTED_BOX_FORMATS)
3521+
@pytest.mark.parametrize("format", list(tv_tensors.BoundingBoxFormat))
35323522
@pytest.mark.parametrize("inplace", [False, True])
35333523
def test_kernel_noop(self, format, inplace):
35343524
input = make_bounding_boxes(format=format).as_subclass(torch.Tensor)
@@ -3552,13 +3542,9 @@ def test_kernel_inplace(self, old_format, new_format):
35523542
output_inplace = F.convert_bounding_box_format(
35533543
input, old_format=old_format, new_format=new_format, inplace=True
35543544
)
3555-
if old_format != tv_tensors.BoundingBoxFormat.XYXYXYXY and new_format != tv_tensors.BoundingBoxFormat.XYXYXYXY:
3556-
# NOTE: BoundingBox format conversion from and to XYXYXYXY format
3557-
# cannot modify the input tensor inplace as it requires a dimension
3558-
# change.
3559-
assert output_inplace.data_ptr() == input.data_ptr()
3560-
assert output_inplace._version > input_version
3561-
assert output_inplace is input
3545+
assert output_inplace.data_ptr() == input.data_ptr()
3546+
assert output_inplace._version > input_version
3547+
assert output_inplace is input
35623548

35633549
assert_equal(output_inplace, output_out_of_place)
35643550

@@ -3577,7 +3563,7 @@ def test_transform(self, old_format, new_format, format_type):
35773563
@pytest.mark.parametrize(("old_format", "new_format"), old_new_formats)
35783564
def test_strings(self, old_format, new_format):
35793565
# Non-regression test for https://github.com/pytorch/vision/issues/8258
3580-
input = make_bounding_boxes(format=old_format, canvas_size=(50, 50))
3566+
input = tv_tensors.BoundingBoxes(torch.tensor([[10, 10, 20, 20]]), format=old_format, canvas_size=(50, 50))
35813567
expected = self._reference_convert_bounding_box_format(input, new_format)
35823568

35833569
old_format = old_format.name
@@ -3742,7 +3728,7 @@ def _reference_resized_crop_bounding_boxes(self, bounding_boxes, *, top, left, h
37423728
new_canvas_size=size,
37433729
)
37443730

3745-
@pytest.mark.parametrize("format", SUPPORTED_BOX_FORMATS)
3731+
@pytest.mark.parametrize("format", list(tv_tensors.BoundingBoxFormat))
37463732
def test_functional_bounding_boxes_correctness(self, format):
37473733
bounding_boxes = make_bounding_boxes(self.INPUT_SIZE, format=format)
37483734

@@ -3816,7 +3802,7 @@ def test_kernel_image(self, param, value, dtype, device):
38163802
),
38173803
)
38183804

3819-
@pytest.mark.parametrize("format", SUPPORTED_BOX_FORMATS)
3805+
@pytest.mark.parametrize("format", list(tv_tensors.BoundingBoxFormat))
38203806
def test_kernel_bounding_boxes(self, format):
38213807
bounding_boxes = make_bounding_boxes(format=format)
38223808
check_kernel(
@@ -3935,7 +3921,7 @@ def _reference_pad_bounding_boxes(self, bounding_boxes, *, padding):
39353921
)
39363922

39373923
@pytest.mark.parametrize("padding", CORRECTNESS_PADDINGS)
3938-
@pytest.mark.parametrize("format", SUPPORTED_BOX_FORMATS)
3924+
@pytest.mark.parametrize("format", list(tv_tensors.BoundingBoxFormat))
39393925
@pytest.mark.parametrize("dtype", [torch.int64, torch.float32])
39403926
@pytest.mark.parametrize("device", cpu_and_cuda())
39413927
@pytest.mark.parametrize("fn", [F.pad, transform_cls_to_functional(transforms.Pad)])
@@ -3964,7 +3950,7 @@ def test_kernel_image(self, output_size, dtype, device):
39643950
)
39653951

39663952
@pytest.mark.parametrize("output_size", OUTPUT_SIZES)
3967-
@pytest.mark.parametrize("format", SUPPORTED_BOX_FORMATS)
3953+
@pytest.mark.parametrize("format", list(tv_tensors.BoundingBoxFormat))
39683954
def test_kernel_bounding_boxes(self, output_size, format):
39693955
bounding_boxes = make_bounding_boxes(self.INPUT_SIZE, format=format)
39703956
check_kernel(
@@ -4043,7 +4029,7 @@ def _reference_center_crop_bounding_boxes(self, bounding_boxes, output_size):
40434029
)
40444030

40454031
@pytest.mark.parametrize("output_size", OUTPUT_SIZES)
4046-
@pytest.mark.parametrize("format", SUPPORTED_BOX_FORMATS)
4032+
@pytest.mark.parametrize("format", list(tv_tensors.BoundingBoxFormat))
40474033
@pytest.mark.parametrize("dtype", [torch.int64, torch.float32])
40484034
@pytest.mark.parametrize("device", cpu_and_cuda())
40494035
@pytest.mark.parametrize("fn", [F.center_crop, transform_cls_to_functional(transforms.CenterCrop)])
@@ -4110,7 +4096,7 @@ def test_kernel_image_error(self):
41104096
coefficients=COEFFICIENTS,
41114097
start_end_points=START_END_POINTS,
41124098
)
4113-
@pytest.mark.parametrize("format", SUPPORTED_BOX_FORMATS)
4099+
@pytest.mark.parametrize("format", list(tv_tensors.BoundingBoxFormat))
41144100
def test_kernel_bounding_boxes(self, param, value, format):
41154101
if param == "start_end_points":
41164102
kwargs = dict(zip(["startpoints", "endpoints"], value))
@@ -4286,7 +4272,7 @@ def perspective_bounding_boxes(bounding_boxes):
42864272
)
42874273

42884274
@pytest.mark.parametrize(("startpoints", "endpoints"), START_END_POINTS)
4289-
@pytest.mark.parametrize("format", SUPPORTED_BOX_FORMATS)
4275+
@pytest.mark.parametrize("format", list(tv_tensors.BoundingBoxFormat))
42904276
@pytest.mark.parametrize("dtype", [torch.int64, torch.float32])
42914277
@pytest.mark.parametrize("device", cpu_and_cuda())
42924278
def test_correctness_perspective_bounding_boxes(self, startpoints, endpoints, format, dtype, device):
@@ -4493,7 +4479,7 @@ def test_correctness_image(self, mean, std, dtype, fn):
44934479

44944480

44954481
class TestClampBoundingBoxes:
4496-
@pytest.mark.parametrize("format", SUPPORTED_BOX_FORMATS)
4482+
@pytest.mark.parametrize("format", list(tv_tensors.BoundingBoxFormat))
44974483
@pytest.mark.parametrize("dtype", [torch.int64, torch.float32])
44984484
@pytest.mark.parametrize("device", cpu_and_cuda())
44994485
def test_kernel(self, format, dtype, device):
@@ -4505,7 +4491,7 @@ def test_kernel(self, format, dtype, device):
45054491
canvas_size=bounding_boxes.canvas_size,
45064492
)
45074493

4508-
@pytest.mark.parametrize("format", SUPPORTED_BOX_FORMATS)
4494+
@pytest.mark.parametrize("format", list(tv_tensors.BoundingBoxFormat))
45094495
def test_functional(self, format):
45104496
check_functional(F.clamp_bounding_boxes, make_bounding_boxes(format=format))
45114497

0 commit comments

Comments
 (0)