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
wangsen
paddle_dbnet
Commits
6783c2a4
Unverified
Commit
6783c2a4
authored
Mar 11, 2021
by
zhoujun
Committed by
GitHub
Mar 11, 2021
Browse files
Merge branch 'dygraph' into fix_mem
parents
1271db6d
0e332fb5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
ppocr/data/imaug/randaugment.py
ppocr/data/imaug/randaugment.py
+4
-1
No files found.
ppocr/data/imaug/randaugment.py
View file @
6783c2a4
...
@@ -117,13 +117,16 @@ class RawRandAugment(object):
...
@@ -117,13 +117,16 @@ class RawRandAugment(object):
class
RandAugment
(
RawRandAugment
):
class
RandAugment
(
RawRandAugment
):
""" RandAugment wrapper to auto fit different img types """
""" RandAugment wrapper to auto fit different img types """
def
__init__
(
self
,
*
args
,
**
kwargs
):
def
__init__
(
self
,
prob
=
0.5
,
*
args
,
**
kwargs
):
self
.
prob
=
prob
if
six
.
PY2
:
if
six
.
PY2
:
super
(
RandAugment
,
self
).
__init__
(
*
args
,
**
kwargs
)
super
(
RandAugment
,
self
).
__init__
(
*
args
,
**
kwargs
)
else
:
else
:
super
().
__init__
(
*
args
,
**
kwargs
)
super
().
__init__
(
*
args
,
**
kwargs
)
def
__call__
(
self
,
data
):
def
__call__
(
self
,
data
):
if
np
.
random
.
rand
()
>
self
.
prob
:
return
data
img
=
data
[
'image'
]
img
=
data
[
'image'
]
if
not
isinstance
(
img
,
Image
.
Image
):
if
not
isinstance
(
img
,
Image
.
Image
):
img
=
np
.
ascontiguousarray
(
img
)
img
=
np
.
ascontiguousarray
(
img
)
...
...
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