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
b83d5f7c
".github/vscode:/vscode.git/clone" did not exist on "bdf381c8c473d95a60a0f41c83ce1ada153862b6"
Unverified
Commit
b83d5f7c
authored
Aug 18, 2022
by
Philip Meier
Committed by
GitHub
Aug 18, 2022
Browse files
add support for apply probability to CutMix and MixUp (#6448)
parent
2a0eea82
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
torchvision/prototype/transforms/_augment.py
torchvision/prototype/transforms/_augment.py
+4
-4
No files found.
torchvision/prototype/transforms/_augment.py
View file @
b83d5f7c
...
@@ -6,7 +6,7 @@ from typing import Any, Dict, Tuple
...
@@ -6,7 +6,7 @@ from typing import Any, Dict, Tuple
import
PIL.Image
import
PIL.Image
import
torch
import
torch
from
torchvision.prototype
import
features
from
torchvision.prototype
import
features
from
torchvision.prototype.transforms
import
functional
as
F
,
Transform
from
torchvision.prototype.transforms
import
functional
as
F
from
._transform
import
_RandomApplyTransform
from
._transform
import
_RandomApplyTransform
from
._utils
import
get_image_dimensions
,
has_all
,
has_any
,
is_simple_tensor
,
query_image
from
._utils
import
get_image_dimensions
,
has_all
,
has_any
,
is_simple_tensor
,
query_image
...
@@ -97,9 +97,9 @@ class RandomErasing(_RandomApplyTransform):
...
@@ -97,9 +97,9 @@ class RandomErasing(_RandomApplyTransform):
return
inpt
return
inpt
class
_BaseMixupCutmix
(
Transform
):
class
_BaseMixupCutmix
(
_RandomApply
Transform
):
def
__init__
(
self
,
*
,
alpha
:
float
)
->
None
:
def
__init__
(
self
,
*
,
alpha
:
float
,
p
:
float
=
0.5
)
->
None
:
super
().
__init__
()
super
().
__init__
(
p
=
p
)
self
.
alpha
=
alpha
self
.
alpha
=
alpha
self
.
_dist
=
torch
.
distributions
.
Beta
(
torch
.
tensor
([
alpha
]),
torch
.
tensor
([
alpha
]))
self
.
_dist
=
torch
.
distributions
.
Beta
(
torch
.
tensor
([
alpha
]),
torch
.
tensor
([
alpha
]))
...
...
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