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
acabaf80
Unverified
Commit
acabaf80
authored
Feb 13, 2023
by
Philip Meier
Committed by
GitHub
Feb 13, 2023
Browse files
fix {convert_format, clamp}_bounding_box (#7229)
parent
af7c6c04
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
torchvision/prototype/transforms/functional/_meta.py
torchvision/prototype/transforms/functional/_meta.py
+5
-3
No files found.
torchvision/prototype/transforms/functional/_meta.py
View file @
acabaf80
...
@@ -230,8 +230,10 @@ def convert_format_bounding_box(
...
@@ -230,8 +230,10 @@ def convert_format_bounding_box(
elif
isinstance
(
inpt
,
datapoints
.
BoundingBox
):
elif
isinstance
(
inpt
,
datapoints
.
BoundingBox
):
if
old_format
is
not
None
:
if
old_format
is
not
None
:
raise
ValueError
(
"For bounding box datapoint inputs, `old_format` must not be passed."
)
raise
ValueError
(
"For bounding box datapoint inputs, `old_format` must not be passed."
)
output
=
_convert_format_bounding_box
(
inpt
,
old_format
=
inpt
.
format
,
new_format
=
new_format
,
inplace
=
inplace
)
output
=
_convert_format_bounding_box
(
return
datapoints
.
BoundingBox
.
wrap_like
(
inpt
,
output
)
inpt
.
as_subclass
(
torch
.
Tensor
),
old_format
=
inpt
.
format
,
new_format
=
new_format
,
inplace
=
inplace
)
return
datapoints
.
BoundingBox
.
wrap_like
(
inpt
,
output
,
format
=
new_format
)
else
:
else
:
raise
TypeError
(
raise
TypeError
(
f
"Input can either be a plain tensor or a bounding box datapoint, but got
{
type
(
inpt
)
}
instead."
f
"Input can either be a plain tensor or a bounding box datapoint, but got
{
type
(
inpt
)
}
instead."
...
@@ -266,7 +268,7 @@ def clamp_bounding_box(
...
@@ -266,7 +268,7 @@ def clamp_bounding_box(
elif
isinstance
(
inpt
,
datapoints
.
BoundingBox
):
elif
isinstance
(
inpt
,
datapoints
.
BoundingBox
):
if
format
is
not
None
or
spatial_size
is
not
None
:
if
format
is
not
None
or
spatial_size
is
not
None
:
raise
ValueError
(
"For bounding box datapoint inputs, `format` and `spatial_size` must not be passed."
)
raise
ValueError
(
"For bounding box datapoint inputs, `format` and `spatial_size` must not be passed."
)
output
=
_clamp_bounding_box
(
inpt
,
format
=
inpt
.
format
,
spatial_size
=
inpt
.
spatial_size
)
output
=
_clamp_bounding_box
(
inpt
.
as_subclass
(
torch
.
Tensor
)
,
format
=
inpt
.
format
,
spatial_size
=
inpt
.
spatial_size
)
return
datapoints
.
BoundingBox
.
wrap_like
(
inpt
,
output
)
return
datapoints
.
BoundingBox
.
wrap_like
(
inpt
,
output
)
else
:
else
:
raise
TypeError
(
raise
TypeError
(
...
...
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