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
56b04976
Unverified
Commit
56b04976
authored
Feb 17, 2023
by
Philip Meier
Committed by
GitHub
Feb 17, 2023
Browse files
Add more tests for bounding boxes (#7276)
parent
dfa81ce4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
0 deletions
+31
-0
test/test_prototype_transforms.py
test/test_prototype_transforms.py
+15
-0
test/test_prototype_transforms_functional.py
test/test_prototype_transforms_functional.py
+16
-0
No files found.
test/test_prototype_transforms.py
View file @
56b04976
...
@@ -269,6 +269,21 @@ class TestSmoke:
...
@@ -269,6 +269,21 @@ class TestSmoke:
else
:
else
:
assert
output_item
is
input_item
assert
output_item
is
input_item
if
isinstance
(
input_item
,
datapoints
.
BoundingBox
)
and
not
isinstance
(
transform
,
transforms
.
ConvertBoundingBoxFormat
):
assert
output_item
.
format
==
input_item
.
format
# Enforce that the transform does not turn a degenerate box marked by RandomIoUCrop (or any other future
# transform that does this), back into a valid one.
# TODO: we should test that against all degenerate boxes above
for
format
in
list
(
datapoints
.
BoundingBoxFormat
):
sample
=
dict
(
boxes
=
datapoints
.
BoundingBox
([[
0
,
0
,
0
,
0
]],
format
=
format
,
spatial_size
=
(
224
,
244
)),
labels
=
torch
.
tensor
([
3
]),
)
assert
transforms
.
SanitizeBoundingBoxes
()(
sample
)[
"boxes"
].
shape
==
(
0
,
4
)
@
parametrize
(
@
parametrize
(
[
[
(
(
...
...
test/test_prototype_transforms_functional.py
View file @
56b04976
...
@@ -508,6 +508,22 @@ class TestDispatchers:
...
@@ -508,6 +508,22 @@ class TestDispatchers:
with
pytest
.
raises
(
TypeError
,
match
=
re
.
escape
(
str
(
type
(
unkown_input
)))):
with
pytest
.
raises
(
TypeError
,
match
=
re
.
escape
(
str
(
type
(
unkown_input
)))):
info
.
dispatcher
(
unkown_input
,
*
other_args
,
**
kwargs
)
info
.
dispatcher
(
unkown_input
,
*
other_args
,
**
kwargs
)
@
make_info_args_kwargs_parametrization
(
[
info
for
info
in
DISPATCHER_INFOS
if
datapoints
.
BoundingBox
in
info
.
kernels
and
info
.
dispatcher
is
not
F
.
convert_format_bounding_box
],
args_kwargs_fn
=
lambda
info
:
info
.
sample_inputs
(
datapoints
.
BoundingBox
),
)
def
test_bounding_box_format_consistency
(
self
,
info
,
args_kwargs
):
(
bounding_box
,
*
other_args
),
kwargs
=
args_kwargs
.
load
()
format
=
bounding_box
.
format
output
=
info
.
dispatcher
(
bounding_box
,
*
other_args
,
**
kwargs
)
assert
output
.
format
==
format
@
pytest
.
mark
.
parametrize
(
@
pytest
.
mark
.
parametrize
(
(
"alias"
,
"target"
),
(
"alias"
,
"target"
),
...
...
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