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
e84ea266
"git@developer.sourcefind.cn:chenpangpang/open-webui.git" did not exist on "a6af20e1eb3a4faade1488730acda46f0eca693a"
Unverified
Commit
e84ea266
authored
Dec 13, 2020
by
littletomatodonkey
Committed by
GitHub
Dec 13, 2020
Browse files
fix prob (#1404)
parent
52671b7d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
5 deletions
+4
-5
ppocr/data/imaug/rec_img_aug.py
ppocr/data/imaug/rec_img_aug.py
+4
-5
No files found.
ppocr/data/imaug/rec_img_aug.py
View file @
e84ea266
...
@@ -35,12 +35,13 @@ from .text_image_aug import tia_perspective, tia_stretch, tia_distort
...
@@ -35,12 +35,13 @@ from .text_image_aug import tia_perspective, tia_stretch, tia_distort
class
RecAug
(
object
):
class
RecAug
(
object
):
def
__init__
(
self
,
use_tia
=
True
,
**
kwargs
z
):
def
__init__
(
self
,
use_tia
=
True
,
aug_prob
=
0.4
,
**
kwargs
):
self
.
use_tia
=
use_tia
self
.
use_tia
=
use_tia
self
.
aug_prob
=
aug_prob
def
__call__
(
self
,
data
):
def
__call__
(
self
,
data
):
img
=
data
[
'image'
]
img
=
data
[
'image'
]
img
=
warp
(
img
,
10
,
self
.
use_tia
)
img
=
warp
(
img
,
10
,
self
.
use_tia
,
self
.
aug_prob
)
data
[
'image'
]
=
img
data
[
'image'
]
=
img
return
data
return
data
...
@@ -329,7 +330,7 @@ def get_warpAffine(config):
...
@@ -329,7 +330,7 @@ def get_warpAffine(config):
return
rz
return
rz
def
warp
(
img
,
ang
,
use_tia
=
True
):
def
warp
(
img
,
ang
,
use_tia
=
True
,
prob
=
0.4
):
"""
"""
warp
warp
"""
"""
...
@@ -338,8 +339,6 @@ def warp(img, ang, use_tia=True):
...
@@ -338,8 +339,6 @@ def warp(img, ang, use_tia=True):
config
.
make
(
w
,
h
,
ang
)
config
.
make
(
w
,
h
,
ang
)
new_img
=
img
new_img
=
img
prob
=
0.4
if
config
.
distort
:
if
config
.
distort
:
img_height
,
img_width
=
img
.
shape
[
0
:
2
]
img_height
,
img_width
=
img
.
shape
[
0
:
2
]
if
random
.
random
()
<=
prob
and
img_height
>=
20
and
img_width
>=
20
:
if
random
.
random
()
<=
prob
and
img_height
>=
20
and
img_width
>=
20
:
...
...
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