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
849beb9a
Unverified
Commit
849beb9a
authored
Jun 01, 2022
by
xiaoting
Committed by
GitHub
Jun 01, 2022
Browse files
update pipeline to v3 (#6466)
* update pipeline to v3 * update pipeline to v3
parent
8bdb9d4e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
deploy/pdserving/ocr_reader.py
deploy/pdserving/ocr_reader.py
+3
-3
deploy/pdserving/web_service.py
deploy/pdserving/web_service.py
+3
-3
No files found.
deploy/pdserving/ocr_reader.py
View file @
849beb9a
...
@@ -339,7 +339,7 @@ class CharacterOps(object):
...
@@ -339,7 +339,7 @@ class CharacterOps(object):
class
OCRReader
(
object
):
class
OCRReader
(
object
):
def
__init__
(
self
,
def
__init__
(
self
,
algorithm
=
"CRNN"
,
algorithm
=
"CRNN"
,
image_shape
=
[
3
,
32
,
320
],
image_shape
=
[
3
,
48
,
320
],
char_type
=
"ch"
,
char_type
=
"ch"
,
batch_num
=
1
,
batch_num
=
1
,
char_dict_path
=
"./ppocr_keys_v1.txt"
):
char_dict_path
=
"./ppocr_keys_v1.txt"
):
...
@@ -356,7 +356,7 @@ class OCRReader(object):
...
@@ -356,7 +356,7 @@ class OCRReader(object):
def
resize_norm_img
(
self
,
img
,
max_wh_ratio
):
def
resize_norm_img
(
self
,
img
,
max_wh_ratio
):
imgC
,
imgH
,
imgW
=
self
.
rec_image_shape
imgC
,
imgH
,
imgW
=
self
.
rec_image_shape
if
self
.
character_type
==
"ch"
:
if
self
.
character_type
==
"ch"
:
imgW
=
int
(
32
*
max_wh_ratio
)
imgW
=
int
(
imgH
*
max_wh_ratio
)
h
=
img
.
shape
[
0
]
h
=
img
.
shape
[
0
]
w
=
img
.
shape
[
1
]
w
=
img
.
shape
[
1
]
ratio
=
w
/
float
(
h
)
ratio
=
w
/
float
(
h
)
...
@@ -377,7 +377,7 @@ class OCRReader(object):
...
@@ -377,7 +377,7 @@ class OCRReader(object):
def
preprocess
(
self
,
img_list
):
def
preprocess
(
self
,
img_list
):
img_num
=
len
(
img_list
)
img_num
=
len
(
img_list
)
norm_img_batch
=
[]
norm_img_batch
=
[]
max_wh_ratio
=
0
max_wh_ratio
=
320
/
48.
for
ino
in
range
(
img_num
):
for
ino
in
range
(
img_num
):
h
,
w
=
img_list
[
ino
].
shape
[
0
:
2
]
h
,
w
=
img_list
[
ino
].
shape
[
0
:
2
]
wh_ratio
=
w
*
1.0
/
h
wh_ratio
=
w
*
1.0
/
h
...
...
deploy/pdserving/web_service.py
View file @
849beb9a
...
@@ -63,7 +63,6 @@ class DetOp(Op):
...
@@ -63,7 +63,6 @@ class DetOp(Op):
dt_boxes_list
=
self
.
post_func
(
det_out
,
[
ratio_list
])
dt_boxes_list
=
self
.
post_func
(
det_out
,
[
ratio_list
])
dt_boxes
=
self
.
filter_func
(
dt_boxes_list
[
0
],
[
self
.
ori_h
,
self
.
ori_w
])
dt_boxes
=
self
.
filter_func
(
dt_boxes_list
[
0
],
[
self
.
ori_h
,
self
.
ori_w
])
out_dict
=
{
"dt_boxes"
:
dt_boxes
,
"image"
:
self
.
raw_im
}
out_dict
=
{
"dt_boxes"
:
dt_boxes
,
"image"
:
self
.
raw_im
}
return
out_dict
,
None
,
""
return
out_dict
,
None
,
""
...
@@ -86,7 +85,7 @@ class RecOp(Op):
...
@@ -86,7 +85,7 @@ class RecOp(Op):
dt_boxes
=
copy
.
deepcopy
(
self
.
dt_list
)
dt_boxes
=
copy
.
deepcopy
(
self
.
dt_list
)
feed_list
=
[]
feed_list
=
[]
img_list
=
[]
img_list
=
[]
max_wh_ratio
=
0
max_wh_ratio
=
320
/
48.
## Many mini-batchs, the type of feed_data is list.
## Many mini-batchs, the type of feed_data is list.
max_batch_size
=
6
# len(dt_boxes)
max_batch_size
=
6
# len(dt_boxes)
...
@@ -150,6 +149,7 @@ class RecOp(Op):
...
@@ -150,6 +149,7 @@ class RecOp(Op):
for
i
in
range
(
dt_num
):
for
i
in
range
(
dt_num
):
text
=
rec_list
[
i
]
text
=
rec_list
[
i
]
dt_box
=
self
.
dt_list
[
i
]
dt_box
=
self
.
dt_list
[
i
]
if
text
[
1
]
>=
0.5
:
result_list
.
append
([
text
,
dt_box
.
tolist
()])
result_list
.
append
([
text
,
dt_box
.
tolist
()])
res
=
{
"result"
:
str
(
result_list
)}
res
=
{
"result"
:
str
(
result_list
)}
return
res
,
None
,
""
return
res
,
None
,
""
...
...
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