Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
vision
Commits
56fb0bf5
"docs/vscode:/vscode.git/clone" did not exist on "dad8751d29328957efb4732a1bbcf38bee7bc184"
Unverified
Commit
56fb0bf5
authored
Mar 23, 2022
by
Philip Meier
Committed by
GitHub
Mar 23, 2022
Browse files
cleanup prototype transforms functional test (#5668)
parent
151e1622
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
19 deletions
+18
-19
test/test_prototype_transforms_functional.py
test/test_prototype_transforms_functional.py
+18
-19
No files found.
test/test_prototype_transforms_functional.py
View file @
56fb0bf5
...
...
@@ -379,12 +379,15 @@ def test_correctness_affine_bounding_box(angle, translate, scale, shear, center)
np
.
max
(
transformed_points
[:,
1
]),
]
out_bbox
=
features
.
BoundingBox
(
out_bbox
,
format
=
features
.
BoundingBoxFormat
.
XYXY
,
image_size
=
bbox
.
image_size
,
dtype
=
torch
.
float32
out_bbox
,
format
=
features
.
BoundingBoxFormat
.
XYXY
,
image_size
=
bbox
.
image_size
,
dtype
=
torch
.
float32
,
device
=
bbox
.
device
,
)
out_bbox
=
convert_bounding_box_format
(
return
convert_bounding_box_format
(
out_bbox
,
old_format
=
features
.
BoundingBoxFormat
.
XYXY
,
new_format
=
bbox
.
format
,
copy
=
False
)
return
out_bbox
.
to
(
bbox
.
device
)
image_size
=
(
32
,
38
)
...
...
@@ -439,8 +442,8 @@ def test_correctness_affine_bounding_box_on_fixed_input(device):
[
1
,
1
,
5
,
5
],
]
in_boxes
=
features
.
BoundingBox
(
in_boxes
,
format
=
features
.
BoundingBoxFormat
.
XYXY
,
image_size
=
image_size
,
dtype
=
torch
.
float64
)
.
to
(
device
)
in_boxes
,
format
=
features
.
BoundingBoxFormat
.
XYXY
,
image_size
=
image_size
,
dtype
=
torch
.
float64
,
device
=
device
)
# Tested parameters
angle
=
63
scale
=
0.89
...
...
@@ -473,9 +476,7 @@ def test_correctness_affine_bounding_box_on_fixed_input(device):
shear
=
(
0
,
0
),
)
assert
len
(
output_boxes
)
==
len
(
expected_bboxes
)
for
a_out_box
,
out_box
in
zip
(
expected_bboxes
,
output_boxes
.
cpu
()):
np
.
testing
.
assert_allclose
(
out_box
.
cpu
().
numpy
(),
a_out_box
)
torch
.
testing
.
assert_close
(
output_boxes
.
tolist
(),
expected_bboxes
)
@
pytest
.
mark
.
parametrize
(
"angle"
,
[
-
54
,
56
])
...
...
@@ -589,12 +590,15 @@ def test_correctness_rotate_bounding_box(angle, expand, center):
out_bbox
[
3
]
-=
tr_y
out_bbox
=
features
.
BoundingBox
(
out_bbox
,
format
=
features
.
BoundingBoxFormat
.
XYXY
,
image_size
=
image_size
,
dtype
=
torch
.
float32
out_bbox
,
format
=
features
.
BoundingBoxFormat
.
XYXY
,
image_size
=
image_size
,
dtype
=
torch
.
float32
,
device
=
bbox
.
device
,
)
out_bbox
=
convert_bounding_box_format
(
return
convert_bounding_box_format
(
out_bbox
,
old_format
=
features
.
BoundingBoxFormat
.
XYXY
,
new_format
=
bbox
.
format
,
copy
=
False
)
return
out_bbox
.
to
(
bbox
.
device
)
image_size
=
(
32
,
38
)
...
...
@@ -630,9 +634,6 @@ def test_correctness_rotate_bounding_box(angle, expand, center):
expected_bboxes
=
torch
.
stack
(
expected_bboxes
)
else
:
expected_bboxes
=
expected_bboxes
[
0
]
print
(
"input:"
,
bboxes
)
print
(
"output_bboxes:"
,
output_bboxes
)
print
(
"expected_bboxes:"
,
expected_bboxes
)
torch
.
testing
.
assert_close
(
output_bboxes
,
expected_bboxes
)
...
...
@@ -649,8 +650,8 @@ def test_correctness_rotate_bounding_box_on_fixed_input(device, expand):
[
image_size
[
1
]
//
2
-
10
,
image_size
[
0
]
//
2
-
10
,
image_size
[
1
]
//
2
+
10
,
image_size
[
0
]
//
2
+
10
],
]
in_boxes
=
features
.
BoundingBox
(
in_boxes
,
format
=
features
.
BoundingBoxFormat
.
XYXY
,
image_size
=
image_size
,
dtype
=
torch
.
float64
)
.
to
(
device
)
in_boxes
,
format
=
features
.
BoundingBoxFormat
.
XYXY
,
image_size
=
image_size
,
dtype
=
torch
.
float64
,
device
=
device
)
# Tested parameters
angle
=
45
center
=
None
if
expand
else
[
12
,
23
]
...
...
@@ -687,6 +688,4 @@ def test_correctness_rotate_bounding_box_on_fixed_input(device, expand):
center
=
center
,
)
assert
len
(
output_boxes
)
==
len
(
expected_bboxes
)
for
a_out_box
,
out_box
in
zip
(
expected_bboxes
,
output_boxes
.
cpu
()):
np
.
testing
.
assert_allclose
(
out_box
.
cpu
().
numpy
(),
a_out_box
)
torch
.
testing
.
assert_close
(
output_boxes
.
tolist
(),
expected_bboxes
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment