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
0c8acf90
"...git@developer.sourcefind.cn:chenpangpang/open-webui.git" did not exist on "d60f06608e9eb7674011683385035bc73eccc128"
Commit
0c8acf90
authored
Nov 04, 2021
by
LDOUBLEV
Browse files
add refer to east and sast preprocess
parent
9b9b2d60
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
14 deletions
+14
-14
ppocr/data/imaug/east_process.py
ppocr/data/imaug/east_process.py
+10
-13
ppocr/data/imaug/sast_process.py
ppocr/data/imaug/sast_process.py
+4
-1
No files found.
ppocr/data/imaug/east_process.py
View file @
0c8acf90
...
@@ -11,7 +11,10 @@
...
@@ -11,7 +11,10 @@
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#See the License for the specific language governing permissions and
#See the License for the specific language governing permissions and
#limitations under the License.
#limitations under the License.
"""
This code is refer from:
https://github.com/songdejia/EAST/blob/master/data_utils.py
"""
import
math
import
math
import
cv2
import
cv2
import
numpy
as
np
import
numpy
as
np
...
@@ -24,10 +27,10 @@ __all__ = ['EASTProcessTrain']
...
@@ -24,10 +27,10 @@ __all__ = ['EASTProcessTrain']
class
EASTProcessTrain
(
object
):
class
EASTProcessTrain
(
object
):
def
__init__
(
self
,
def
__init__
(
self
,
image_shape
=
[
512
,
512
],
image_shape
=
[
512
,
512
],
background_ratio
=
0.125
,
background_ratio
=
0.125
,
min_crop_side_ratio
=
0.1
,
min_crop_side_ratio
=
0.1
,
min_text_size
=
10
,
min_text_size
=
10
,
**
kwargs
):
**
kwargs
):
self
.
input_size
=
image_shape
[
1
]
self
.
input_size
=
image_shape
[
1
]
self
.
random_scale
=
np
.
array
([
0.5
,
1
,
2.0
,
3.0
])
self
.
random_scale
=
np
.
array
([
0.5
,
1
,
2.0
,
3.0
])
...
@@ -282,12 +285,7 @@ class EASTProcessTrain(object):
...
@@ -282,12 +285,7 @@ class EASTProcessTrain(object):
1.0
/
max
(
min
(
poly_h
,
poly_w
),
1.0
)
1.0
/
max
(
min
(
poly_h
,
poly_w
),
1.0
)
return
score_map
,
geo_map
,
training_mask
return
score_map
,
geo_map
,
training_mask
def
crop_area
(
self
,
def
crop_area
(
self
,
im
,
polys
,
tags
,
crop_background
=
False
,
max_tries
=
50
):
im
,
polys
,
tags
,
crop_background
=
False
,
max_tries
=
50
):
"""
"""
make random crop from the input image
make random crop from the input image
:param im:
:param im:
...
@@ -435,5 +433,4 @@ class EASTProcessTrain(object):
...
@@ -435,5 +433,4 @@ class EASTProcessTrain(object):
data
[
'score_map'
]
=
score_map
data
[
'score_map'
]
=
score_map
data
[
'geo_map'
]
=
geo_map
data
[
'geo_map'
]
=
geo_map
data
[
'training_mask'
]
=
training_mask
data
[
'training_mask'
]
=
training_mask
# print(im.shape, score_map.shape, geo_map.shape, training_mask.shape)
return
data
return
data
\ No newline at end of file
ppocr/data/imaug/sast_process.py
View file @
0c8acf90
...
@@ -11,7 +11,10 @@
...
@@ -11,7 +11,10 @@
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#See the License for the specific language governing permissions and
#See the License for the specific language governing permissions and
#limitations under the License.
#limitations under the License.
"""
This part code is refer from:
https://github.com/songdejia/EAST/blob/master/data_utils.py
"""
import
math
import
math
import
cv2
import
cv2
import
numpy
as
np
import
numpy
as
np
...
...
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