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
ModelZoo
ResNet50_tensorflow
Commits
7214e17e
Commit
7214e17e
authored
Feb 22, 2022
by
A. Unique TensorFlower
Browse files
Internal change
PiperOrigin-RevId: 430245113
parent
0967769d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
official/vision/beta/ops/augment.py
official/vision/beta/ops/augment.py
+2
-2
No files found.
official/vision/beta/ops/augment.py
View file @
7214e17e
...
@@ -2259,7 +2259,7 @@ class MixupAndCutmix:
...
@@ -2259,7 +2259,7 @@ class MixupAndCutmix:
labels
:
tf
.
Tensor
)
->
Tuple
[
tf
.
Tensor
,
tf
.
Tensor
,
tf
.
Tensor
]:
labels
:
tf
.
Tensor
)
->
Tuple
[
tf
.
Tensor
,
tf
.
Tensor
,
tf
.
Tensor
]:
"""Apply cutmix."""
"""Apply cutmix."""
lam
=
MixupAndCutmix
.
_sample_from_beta
(
self
.
cutmix_alpha
,
self
.
cutmix_alpha
,
lam
=
MixupAndCutmix
.
_sample_from_beta
(
self
.
cutmix_alpha
,
self
.
cutmix_alpha
,
labels
.
shape
)
tf
.
shape
(
labels
)
)
ratio
=
tf
.
math
.
sqrt
(
1
-
lam
)
ratio
=
tf
.
math
.
sqrt
(
1
-
lam
)
...
@@ -2293,7 +2293,7 @@ class MixupAndCutmix:
...
@@ -2293,7 +2293,7 @@ class MixupAndCutmix:
def
_mixup
(
self
,
images
:
tf
.
Tensor
,
def
_mixup
(
self
,
images
:
tf
.
Tensor
,
labels
:
tf
.
Tensor
)
->
Tuple
[
tf
.
Tensor
,
tf
.
Tensor
,
tf
.
Tensor
]:
labels
:
tf
.
Tensor
)
->
Tuple
[
tf
.
Tensor
,
tf
.
Tensor
,
tf
.
Tensor
]:
lam
=
MixupAndCutmix
.
_sample_from_beta
(
self
.
mixup_alpha
,
self
.
mixup_alpha
,
lam
=
MixupAndCutmix
.
_sample_from_beta
(
self
.
mixup_alpha
,
self
.
mixup_alpha
,
labels
.
shape
)
tf
.
shape
(
labels
)
)
lam
=
tf
.
reshape
(
lam
,
[
-
1
,
1
,
1
,
1
])
lam
=
tf
.
reshape
(
lam
,
[
-
1
,
1
,
1
,
1
])
lam_cast
=
tf
.
cast
(
lam
,
dtype
=
images
.
dtype
)
lam_cast
=
tf
.
cast
(
lam
,
dtype
=
images
.
dtype
)
images
=
lam_cast
*
images
+
(
1.
-
lam_cast
)
*
tf
.
reverse
(
images
,
[
0
])
images
=
lam_cast
*
images
+
(
1.
-
lam_cast
)
*
tf
.
reverse
(
images
,
[
0
])
...
...
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