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
11304cb7
".github/git@developer.sourcefind.cn:OpenDAS/bitsandbytes.git" did not exist on "42bc72910fedb0acf049553c74edb746e9c58660"
Unverified
Commit
11304cb7
authored
Sep 01, 2022
by
Philip Meier
Committed by
GitHub
Sep 01, 2022
Browse files
only allow 1 image or bounding box instead of 1 or 2 (#6531)
parent
d5bd8b72
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
torchvision/prototype/transforms/_utils.py
torchvision/prototype/transforms/_utils.py
+2
-2
No files found.
torchvision/prototype/transforms/_utils.py
View file @
11304cb7
...
@@ -14,7 +14,7 @@ def query_bounding_box(sample: Any) -> features.BoundingBox:
...
@@ -14,7 +14,7 @@ def query_bounding_box(sample: Any) -> features.BoundingBox:
bounding_boxes
=
{
item
for
item
in
flat_sample
if
isinstance
(
item
,
features
.
BoundingBox
)}
bounding_boxes
=
{
item
for
item
in
flat_sample
if
isinstance
(
item
,
features
.
BoundingBox
)}
if
not
bounding_boxes
:
if
not
bounding_boxes
:
raise
TypeError
(
"No bounding box was found in the sample"
)
raise
TypeError
(
"No bounding box was found in the sample"
)
elif
len
(
bounding_boxes
)
>
2
:
elif
len
(
bounding_boxes
)
>
1
:
raise
ValueError
(
"Found multiple bounding boxes in the sample"
)
raise
ValueError
(
"Found multiple bounding boxes in the sample"
)
return
bounding_boxes
.
pop
()
return
bounding_boxes
.
pop
()
...
@@ -28,7 +28,7 @@ def query_chw(sample: Any) -> Tuple[int, int, int]:
...
@@ -28,7 +28,7 @@ def query_chw(sample: Any) -> Tuple[int, int, int]:
}
}
if
not
chws
:
if
not
chws
:
raise
TypeError
(
"No image was found in the sample"
)
raise
TypeError
(
"No image was found in the sample"
)
elif
len
(
chws
)
>
2
:
elif
len
(
chws
)
>
1
:
raise
ValueError
(
f
"Found multiple CxHxW dimensions in the sample:
{
sequence_to_str
(
sorted
(
chws
))
}
"
)
raise
ValueError
(
f
"Found multiple CxHxW dimensions in the sample:
{
sequence_to_str
(
sorted
(
chws
))
}
"
)
return
chws
.
pop
()
return
chws
.
pop
()
...
...
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