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
0ee6137d
Commit
0ee6137d
authored
Jun 08, 2021
by
WenmuZhou
Browse files
del pad
parent
4290c697
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
15 deletions
+6
-15
ppocr/data/imaug/operators.py
ppocr/data/imaug/operators.py
+5
-9
ppstructure/predict_system.py
ppstructure/predict_system.py
+1
-2
tools/infer/predict_det.py
tools/infer/predict_det.py
+0
-2
tools/infer/utility.py
tools/infer/utility.py
+0
-2
No files found.
ppocr/data/imaug/operators.py
View file @
0ee6137d
...
...
@@ -122,8 +122,6 @@ class DetResizeForTest(object):
elif
'limit_side_len'
in
kwargs
:
self
.
limit_side_len
=
kwargs
[
'limit_side_len'
]
self
.
limit_type
=
kwargs
.
get
(
'limit_type'
,
'min'
)
self
.
pad
=
kwargs
.
get
(
'pad'
,
False
)
self
.
pad_size
=
kwargs
.
get
(
'pad_size'
,
480
)
elif
'resize_long'
in
kwargs
:
self
.
resize_type
=
2
self
.
resize_long
=
kwargs
.
get
(
'resize_long'
,
960
)
...
...
@@ -174,11 +172,9 @@ class DetResizeForTest(object):
ratio
=
float
(
limit_side_len
)
/
h
else
:
ratio
=
float
(
limit_side_len
)
/
w
elif
self
.
pad
:
ratio
=
float
(
self
.
pad_size
)
/
max
(
h
,
w
)
else
:
ratio
=
1.
el
se
:
el
if
self
.
limit_type
==
'min'
:
if
min
(
h
,
w
)
<
limit_side_len
:
if
h
<
w
:
ratio
=
float
(
limit_side_len
)
/
h
...
...
@@ -186,6 +182,10 @@ class DetResizeForTest(object):
ratio
=
float
(
limit_side_len
)
/
w
else
:
ratio
=
1.
elif
self
.
limit_type
==
'resize_long'
:
ratio
=
float
(
limit_side_len
)
/
max
(
h
,
w
)
else
:
raise
Exception
(
'not support limit type, image '
)
resize_h
=
int
(
h
*
ratio
)
resize_w
=
int
(
w
*
ratio
)
...
...
@@ -201,10 +201,6 @@ class DetResizeForTest(object):
sys
.
exit
(
0
)
ratio_h
=
resize_h
/
float
(
h
)
ratio_w
=
resize_w
/
float
(
w
)
if
self
.
limit_type
==
'max'
and
self
.
pad
:
padding_im
=
np
.
zeros
((
self
.
pad_size
,
self
.
pad_size
,
c
),
dtype
=
np
.
float32
)
padding_im
[:
resize_h
,
:
resize_w
,
:]
=
img
img
=
padding_im
return
img
,
[
ratio_h
,
ratio_w
]
def
resize_image_type2
(
self
,
img
):
...
...
ppstructure/predict_system.py
View file @
0ee6137d
...
...
@@ -38,8 +38,7 @@ logger = get_logger()
class
OCRSystem
(
object
):
def
__init__
(
self
,
args
):
args
.
det_pad
=
True
args
.
det_pad_size
=
960
args
.
det_limit_type
=
'resize_long'
args
.
drop_score
=
0
self
.
text_system
=
TextSystem
(
args
)
self
.
table_system
=
TableSystem
(
args
,
self
.
text_system
.
text_detector
,
self
.
text_system
.
text_recognizer
)
...
...
tools/infer/predict_det.py
View file @
0ee6137d
...
...
@@ -42,8 +42,6 @@ class TextDetector(object):
'DetResizeForTest'
:
{
'limit_side_len'
:
args
.
det_limit_side_len
,
'limit_type'
:
args
.
det_limit_type
,
'pad'
:
args
.
det_pad
,
'pad_size'
:
args
.
det_pad_size
}
},
{
'NormalizeImage'
:
{
...
...
tools/infer/utility.py
View file @
0ee6137d
...
...
@@ -46,8 +46,6 @@ def init_args():
parser
.
add_argument
(
"--det_model_dir"
,
type
=
str
)
parser
.
add_argument
(
"--det_limit_side_len"
,
type
=
float
,
default
=
960
)
parser
.
add_argument
(
"--det_limit_type"
,
type
=
str
,
default
=
'max'
)
parser
.
add_argument
(
"--det_pad"
,
type
=
str2bool
,
default
=
False
)
parser
.
add_argument
(
"--det_pad_size"
,
type
=
int
,
default
=
640
)
# DB parmas
parser
.
add_argument
(
"--det_db_thresh"
,
type
=
float
,
default
=
0.3
)
...
...
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