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
48eba028
Commit
48eba028
authored
Jun 07, 2021
by
WenmuZhou
Browse files
opt output
parent
59671466
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
ppstructure/predict_system.py
ppstructure/predict_system.py
+4
-2
No files found.
ppstructure/predict_system.py
View file @
48eba028
...
...
@@ -42,7 +42,7 @@ class OCRSystem(object):
self
.
table_system
=
TableSystem
(
args
,
self
.
text_system
.
text_detector
,
self
.
text_system
.
text_recognizer
)
self
.
table_layout
=
lp
.
PaddleDetectionLayoutModel
(
"lp://PubLayNet/ppyolov2_r50vd_dcn_365e_publaynet/config"
,
threshold
=
0.5
,
enable_mkldnn
=
args
.
enable_mkldnn
,
enforce_cpu
=
not
args
.
use_gpu
)
enforce_cpu
=
not
args
.
use_gpu
,
thread_num
=
args
.
cpu_threads
)
self
.
use_angle_cls
=
args
.
use_angle_cls
self
.
drop_score
=
args
.
drop_score
...
...
@@ -60,7 +60,9 @@ class OCRSystem(object):
continue
else
:
filter_boxes
,
filter_rec_res
=
self
.
text_system
(
roi_img
)
filter_boxes
=
[
x
+
[
x1
,
y1
]
for
x
in
filter_boxes
]
filter_boxes
=
[
x
.
reshape
(
-
1
).
tolist
()
for
x
in
filter_boxes
]
res
=
(
filter_boxes
,
filter_rec_res
)
res_list
.
append
({
'type'
:
region
.
type
,
'bbox'
:
[
x1
,
y1
,
x2
,
y2
],
'res'
:
res
})
return
res_list
...
...
@@ -78,7 +80,7 @@ def save_res(res, save_folder, img_name):
pass
else
:
with
open
(
os
.
path
.
join
(
excel_save_folder
,
'res.txt'
),
'a'
,
encoding
=
'utf8'
)
as
f
:
for
box
,
rec_res
in
zip
(
region
[
'res'
][
0
],
region
[
'res'
][
1
]):
for
box
,
rec_res
in
zip
(
region
[
'res'
][
0
],
region
[
'res'
][
1
]):
f
.
write
(
'{}
\t
{}
\n
'
.
format
(
np
.
array
(
box
).
reshape
(
-
1
).
tolist
(),
rec_res
))
...
...
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