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
aec38fc2
Unverified
Commit
aec38fc2
authored
Nov 03, 2022
by
vfdev
Committed by
GitHub
Nov 03, 2022
Browse files
[proto][tests] added ref tests for resize bboxes (#6879)
parent
1502ed9a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
1 deletion
+28
-1
test/prototype_transforms_kernel_infos.py
test/prototype_transforms_kernel_infos.py
+28
-1
No files found.
test/prototype_transforms_kernel_infos.py
View file @
aec38fc2
...
@@ -288,6 +288,31 @@ def sample_inputs_resize_video():
...
@@ -288,6 +288,31 @@ def sample_inputs_resize_video():
yield
ArgsKwargs
(
video_loader
,
size
=
[
min
(
video_loader
.
shape
[
-
2
:])
+
1
])
yield
ArgsKwargs
(
video_loader
,
size
=
[
min
(
video_loader
.
shape
[
-
2
:])
+
1
])
def
reference_resize_bounding_box
(
bounding_box
,
*
,
spatial_size
,
size
,
max_size
=
None
):
old_height
,
old_width
=
spatial_size
new_height
,
new_width
=
F
.
_geometry
.
_compute_resized_output_size
(
spatial_size
,
size
=
size
,
max_size
=
max_size
)
affine_matrix
=
np
.
array
(
[
[
new_width
/
old_width
,
0
,
0
],
[
0
,
new_height
/
old_height
,
0
],
],
dtype
=
"float32"
,
)
expected_bboxes
=
reference_affine_bounding_box_helper
(
bounding_box
,
format
=
bounding_box
.
format
,
affine_matrix
=
affine_matrix
)
return
expected_bboxes
,
(
new_height
,
new_width
)
def
reference_inputs_resize_bounding_box
():
for
bounding_box_loader
in
make_bounding_box_loaders
(
extra_dims
=
((),
(
4
,))):
for
size
in
_get_resize_sizes
(
bounding_box_loader
.
spatial_size
):
yield
ArgsKwargs
(
bounding_box_loader
,
size
=
size
,
spatial_size
=
bounding_box_loader
.
spatial_size
)
KERNEL_INFOS
.
extend
(
KERNEL_INFOS
.
extend
(
[
[
KernelInfo
(
KernelInfo
(
...
@@ -303,6 +328,8 @@ KERNEL_INFOS.extend(
...
@@ -303,6 +328,8 @@ KERNEL_INFOS.extend(
KernelInfo
(
KernelInfo
(
F
.
resize_bounding_box
,
F
.
resize_bounding_box
,
sample_inputs_fn
=
sample_inputs_resize_bounding_box
,
sample_inputs_fn
=
sample_inputs_resize_bounding_box
,
reference_fn
=
reference_resize_bounding_box
,
reference_inputs_fn
=
reference_inputs_resize_bounding_box
,
test_marks
=
[
test_marks
=
[
xfail_jit_python_scalar_arg
(
"size"
),
xfail_jit_python_scalar_arg
(
"size"
),
],
],
...
@@ -459,7 +486,7 @@ def reference_affine_bounding_box_helper(bounding_box, *, format, affine_matrix)
...
@@ -459,7 +486,7 @@ def reference_affine_bounding_box_helper(bounding_box, *, format, affine_matrix)
],
],
)
)
out_bbox
=
F
.
convert_format_bounding_box
(
out_bbox
=
F
.
convert_format_bounding_box
(
out_bbox
,
old_format
=
features
.
BoundingBoxFormat
.
XYXY
,
new_format
=
format
,
inplace
=
True
out_bbox
,
old_format
=
features
.
BoundingBoxFormat
.
XYXY
,
new_format
=
format
_
,
inplace
=
True
)
)
return
out_bbox
.
to
(
dtype
=
in_dtype
)
return
out_bbox
.
to
(
dtype
=
in_dtype
)
...
...
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