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
7fefdea3
Unverified
Commit
7fefdea3
authored
Feb 24, 2023
by
vfdev
Committed by
GitHub
Feb 24, 2023
Browse files
Updated _meta.py docstrings (#7320)
Co-authored-by:
Nicolas Hug
<
contact@nicolas-hug.com
>
parent
aef00c4d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
1 deletion
+19
-1
docs/source/transforms.rst
docs/source/transforms.rst
+2
-0
torchvision/transforms/v2/_meta.py
torchvision/transforms/v2/_meta.py
+17
-1
No files found.
docs/source/transforms.rst
View file @
7fefdea3
...
@@ -191,6 +191,7 @@ Miscellaneous
...
@@ -191,6 +191,7 @@ Miscellaneous
Lambda
Lambda
v2.Lambda
v2.Lambda
v2.SanitizeBoundingBox
v2.SanitizeBoundingBox
v2.ClampBoundingBox
.. _conversion_transforms:
.. _conversion_transforms:
...
@@ -212,6 +213,7 @@ Conversion
...
@@ -212,6 +213,7 @@ Conversion
v2.ConvertImageDtype
v2.ConvertImageDtype
v2.ConvertDtype
v2.ConvertDtype
v2.ToDtype
v2.ToDtype
v2.ConvertBoundingBoxFormat
Auto-Augmentation
Auto-Augmentation
-----------------
-----------------
...
...
torchvision/transforms/v2/_meta.py
View file @
7fefdea3
...
@@ -9,6 +9,15 @@ from .utils import is_simple_tensor
...
@@ -9,6 +9,15 @@ from .utils import is_simple_tensor
class
ConvertBoundingBoxFormat
(
Transform
):
class
ConvertBoundingBoxFormat
(
Transform
):
"""[BETA] Convert bounding box coordinates to the given ``format``, e.g. from "CXCYWH" to "XYXY".
.. betastatus:: ConvertBoundingBoxFormat transform
Args:
format (str or datapoints.BoundingBoxFormat): output bounding box format.
Possible values are defined by :class:`~torchvision.datapoints.BoundingBoxFormat` and
string values match the enums, e.g. "XYXY" or "XYWH" etc.
"""
_transformed_types
=
(
datapoints
.
BoundingBox
,)
_transformed_types
=
(
datapoints
.
BoundingBox
,)
def
__init__
(
self
,
format
:
Union
[
str
,
datapoints
.
BoundingBoxFormat
])
->
None
:
def
__init__
(
self
,
format
:
Union
[
str
,
datapoints
.
BoundingBoxFormat
])
->
None
:
...
@@ -22,7 +31,7 @@ class ConvertBoundingBoxFormat(Transform):
...
@@ -22,7 +31,7 @@ class ConvertBoundingBoxFormat(Transform):
class
ConvertDtype
(
Transform
):
class
ConvertDtype
(
Transform
):
"""[BETA] Convert
a tensor image/box/mask
to the given ``dtype`` and scale the values accordingly
"""[BETA] Convert
input image or video
to the given ``dtype`` and scale the values accordingly
.
.. betastatus:: ConvertDtype transform
.. betastatus:: ConvertDtype transform
...
@@ -63,6 +72,13 @@ ConvertImageDtype = ConvertDtype
...
@@ -63,6 +72,13 @@ ConvertImageDtype = ConvertDtype
class
ClampBoundingBox
(
Transform
):
class
ClampBoundingBox
(
Transform
):
"""[BETA] Clamp bounding boxes to their corresponding image dimensions.
The clamping is done according to the bounding boxes' ``spatial_size`` meta-data.
.. betastatus:: ClampBoundingBox transform
"""
_transformed_types
=
(
datapoints
.
BoundingBox
,)
_transformed_types
=
(
datapoints
.
BoundingBox
,)
def
_transform
(
self
,
inpt
:
datapoints
.
BoundingBox
,
params
:
Dict
[
str
,
Any
])
->
datapoints
.
BoundingBox
:
def
_transform
(
self
,
inpt
:
datapoints
.
BoundingBox
,
params
:
Dict
[
str
,
Any
])
->
datapoints
.
BoundingBox
:
...
...
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