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
449cc090
"...python/git@developer.sourcefind.cn:change/sglang.git" did not exist on "3980ff1be6fe2ffb8b2ee1d2a9d3f71a48a42135"
Unverified
Commit
449cc090
authored
Feb 24, 2023
by
Nicolas Hug
Committed by
GitHub
Feb 24, 2023
Browse files
remove strEnum from BoundingBoxFormat (#7322)
parent
7fefdea3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
test/test_datapoints.py
test/test_datapoints.py
+1
-1
torchvision/datapoints/_bounding_box.py
torchvision/datapoints/_bounding_box.py
+6
-6
No files found.
test/test_datapoints.py
View file @
449cc090
...
@@ -28,5 +28,5 @@ def test_bbox_instance(data, format):
...
@@ -28,5 +28,5 @@ def test_bbox_instance(data, format):
assert
isinstance
(
bboxes
,
torch
.
Tensor
)
assert
isinstance
(
bboxes
,
torch
.
Tensor
)
assert
bboxes
.
ndim
==
2
and
bboxes
.
shape
[
1
]
==
4
assert
bboxes
.
ndim
==
2
and
bboxes
.
shape
[
1
]
==
4
if
isinstance
(
format
,
str
):
if
isinstance
(
format
,
str
):
format
=
datapoints
.
BoundingBoxFormat
.
from_str
(
format
.
upper
())
format
=
datapoints
.
BoundingBoxFormat
[
(
format
.
upper
())
]
assert
bboxes
.
format
==
format
assert
bboxes
.
format
==
format
torchvision/datapoints/_bounding_box.py
View file @
449cc090
from
__future__
import
annotations
from
__future__
import
annotations
from
enum
import
Enum
from
typing
import
Any
,
List
,
Optional
,
Sequence
,
Tuple
,
Union
from
typing
import
Any
,
List
,
Optional
,
Sequence
,
Tuple
,
Union
import
torch
import
torch
from
torchvision._utils
import
StrEnum
from
torchvision.transforms
import
InterpolationMode
# TODO: this needs to be moved out of transforms
from
torchvision.transforms
import
InterpolationMode
# TODO: this needs to be moved out of transforms
from
._datapoint
import
_FillTypeJIT
,
Datapoint
from
._datapoint
import
_FillTypeJIT
,
Datapoint
class
BoundingBoxFormat
(
Str
Enum
):
class
BoundingBoxFormat
(
Enum
):
XYXY
=
StrEnum
.
auto
()
XYXY
=
"XYXY"
XYWH
=
StrEnum
.
auto
()
XYWH
=
"XYWH"
CXCYWH
=
StrEnum
.
auto
()
CXCYWH
=
"CXCYWH"
class
BoundingBox
(
Datapoint
):
class
BoundingBox
(
Datapoint
):
...
@@ -39,7 +39,7 @@ class BoundingBox(Datapoint):
...
@@ -39,7 +39,7 @@ class BoundingBox(Datapoint):
tensor
=
cls
.
_to_tensor
(
data
,
dtype
=
dtype
,
device
=
device
,
requires_grad
=
requires_grad
)
tensor
=
cls
.
_to_tensor
(
data
,
dtype
=
dtype
,
device
=
device
,
requires_grad
=
requires_grad
)
if
isinstance
(
format
,
str
):
if
isinstance
(
format
,
str
):
format
=
BoundingBoxFormat
.
from_str
(
format
.
upper
()
)
format
=
BoundingBoxFormat
[
format
.
upper
()
]
return
cls
.
_wrap
(
tensor
,
format
=
format
,
spatial_size
=
spatial_size
)
return
cls
.
_wrap
(
tensor
,
format
=
format
,
spatial_size
=
spatial_size
)
...
...
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