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
784cbc7d
Commit
784cbc7d
authored
Aug 20, 2021
by
Simon Geisler
Browse files
fix random erase probability
parent
fee3ca79
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
official/vision/beta/ops/augment.py
official/vision/beta/ops/augment.py
+3
-3
official/vision/beta/ops/augment_test.py
official/vision/beta/ops/augment_test.py
+1
-1
No files found.
official/vision/beta/ops/augment.py
View file @
784cbc7d
...
...
@@ -1358,8 +1358,8 @@ class RandomErasing(ImageAugment):
tf.Tensor: The augmented version of `image`.
"""
uniform_random
=
tf
.
random
.
uniform
(
shape
=
[],
minval
=
0.
,
maxval
=
1.0
)
mirror_cond
=
tf
.
less
(
uniform_random
,
.
5
)
tf
.
cond
(
mirror_cond
,
lambda
:
self
.
_erase
(
image
),
lambda
:
image
)
mirror_cond
=
tf
.
less
(
uniform_random
,
self
.
_probability
)
image
=
tf
.
cond
(
mirror_cond
,
lambda
:
self
.
_erase
(
image
),
lambda
:
image
)
return
image
@
tf
.
function
...
...
@@ -1399,7 +1399,7 @@ class RandomErasing(ImageAugment):
dtype
=
tf
.
int32
)
image
=
_fill_rectangle
(
image
,
center_width
,
center_height
,
half_width
,
half_height
,
replace
=
None
)
half_width
,
half_height
,
replace
=
None
)
is_trial_successfull
=
True
...
...
official/vision/beta/ops/augment_test.py
View file @
784cbc7d
...
...
@@ -263,7 +263,7 @@ class RandomErasingTest(tf.test.TestCase, parameterized.TestCase):
aug_image
=
augmenter
.
distort
(
image
)
self
.
assertEqual
((
224
,
224
,
3
),
aug_image
.
shape
)
self
.
assert
Less
(
0
,
tf
.
reduce_max
(
aug_image
.
shape
))
self
.
assert
NotEqual
(
0
,
tf
.
reduce_max
(
aug_image
))
class
MixupAndCutmixTest
(
tf
.
test
.
TestCase
,
parameterized
.
TestCase
):
...
...
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