Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleOCR
提交
1dff9f7c
P
PaddleOCR
项目概览
s920243400
/
PaddleOCR
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleOCR
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleOCR
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
1dff9f7c
编写于
10月 28, 2020
作者:
M
MissPenguin
提交者:
GitHub
10月 28, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1037 from wangjiawei04/ocr_1028
pdserving add box positions
上级
2cdafa10
d5492125
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
6 addition
and
4 deletion
+6
-4
deploy/pdserving/ocr_local_server.py
deploy/pdserving/ocr_local_server.py
+3
-1
deploy/pdserving/ocr_rpc_server.py
deploy/pdserving/ocr_rpc_server.py
+3
-3
未找到文件。
deploy/pdserving/ocr_local_server.py
浏览文件 @
1dff9f7c
...
@@ -60,6 +60,7 @@ class TextSystemHelper(TextSystem):
...
@@ -60,6 +60,7 @@ class TextSystemHelper(TextSystem):
return
None
,
None
return
None
,
None
img_crop_list
=
[]
img_crop_list
=
[]
dt_boxes
=
sorted_boxes
(
dt_boxes
)
dt_boxes
=
sorted_boxes
(
dt_boxes
)
self
.
dt_boxes
=
dt_boxes
for
bno
in
range
(
len
(
dt_boxes
)):
for
bno
in
range
(
len
(
dt_boxes
)):
tmp_box
=
copy
.
deepcopy
(
dt_boxes
[
bno
])
tmp_box
=
copy
.
deepcopy
(
dt_boxes
[
bno
])
img_crop
=
self
.
get_rotate_crop_image
(
img
,
tmp_box
)
img_crop
=
self
.
get_rotate_crop_image
(
img
,
tmp_box
)
...
@@ -102,7 +103,8 @@ class OCRService(WebService):
...
@@ -102,7 +103,8 @@ class OCRService(WebService):
rec_res
=
self
.
text_system
.
postprocess
(
outputs
,
self
.
tmp_args
)
rec_res
=
self
.
text_system
.
postprocess
(
outputs
,
self
.
tmp_args
)
res
=
{
res
=
{
"pred_text"
:
[
x
[
0
]
for
x
in
rec_res
],
"pred_text"
:
[
x
[
0
]
for
x
in
rec_res
],
"score"
:
[
str
(
x
[
1
])
for
x
in
rec_res
]
"score"
:
[
str
(
x
[
1
])
for
x
in
rec_res
],
"pos"
:
[
x
.
tolist
()
for
x
in
self
.
text_system
.
dt_boxes
]
}
}
return
res
return
res
...
...
deploy/pdserving/ocr_rpc_server.py
浏览文件 @
1dff9f7c
...
@@ -56,11 +56,11 @@ class TextSystemHelper(TextSystem):
...
@@ -56,11 +56,11 @@ class TextSystemHelper(TextSystem):
fetch_map
=
self
.
det_client
.
predict
(
feed
,
fetch
)
fetch_map
=
self
.
det_client
.
predict
(
feed
,
fetch
)
outputs
=
[
fetch_map
[
x
]
for
x
in
fetch
]
outputs
=
[
fetch_map
[
x
]
for
x
in
fetch
]
dt_boxes
=
self
.
text_detector
.
postprocess
(
outputs
,
self
.
tmp_args
)
dt_boxes
=
self
.
text_detector
.
postprocess
(
outputs
,
self
.
tmp_args
)
print
(
dt_boxes
)
if
dt_boxes
is
None
:
if
dt_boxes
is
None
:
return
None
,
None
return
None
,
None
img_crop_list
=
[]
img_crop_list
=
[]
dt_boxes
=
sorted_boxes
(
dt_boxes
)
dt_boxes
=
sorted_boxes
(
dt_boxes
)
self
.
dt_boxes
=
dt_boxes
for
bno
in
range
(
len
(
dt_boxes
)):
for
bno
in
range
(
len
(
dt_boxes
)):
tmp_box
=
copy
.
deepcopy
(
dt_boxes
[
bno
])
tmp_box
=
copy
.
deepcopy
(
dt_boxes
[
bno
])
img_crop
=
self
.
get_rotate_crop_image
(
img
,
tmp_box
)
img_crop
=
self
.
get_rotate_crop_image
(
img
,
tmp_box
)
...
@@ -69,7 +69,6 @@ class TextSystemHelper(TextSystem):
...
@@ -69,7 +69,6 @@ class TextSystemHelper(TextSystem):
feed
,
fetch
,
self
.
tmp_args
=
self
.
text_classifier
.
preprocess
(
feed
,
fetch
,
self
.
tmp_args
=
self
.
text_classifier
.
preprocess
(
img_crop_list
)
img_crop_list
)
fetch_map
=
self
.
clas_client
.
predict
(
feed
,
fetch
)
fetch_map
=
self
.
clas_client
.
predict
(
feed
,
fetch
)
print
(
fetch_map
)
outputs
=
[
fetch_map
[
x
]
for
x
in
self
.
text_classifier
.
fetch
]
outputs
=
[
fetch_map
[
x
]
for
x
in
self
.
text_classifier
.
fetch
]
for
x
in
fetch_map
.
keys
():
for
x
in
fetch_map
.
keys
():
if
".lod"
in
x
:
if
".lod"
in
x
:
...
@@ -104,7 +103,8 @@ class OCRService(WebService):
...
@@ -104,7 +103,8 @@ class OCRService(WebService):
rec_res
=
self
.
text_system
.
postprocess
(
outputs
,
self
.
tmp_args
)
rec_res
=
self
.
text_system
.
postprocess
(
outputs
,
self
.
tmp_args
)
res
=
{
res
=
{
"pred_text"
:
[
x
[
0
]
for
x
in
rec_res
],
"pred_text"
:
[
x
[
0
]
for
x
in
rec_res
],
"score"
:
[
str
(
x
[
1
])
for
x
in
rec_res
]
"score"
:
[
str
(
x
[
1
])
for
x
in
rec_res
],
"pos"
:
[
x
.
tolist
()
for
x
in
self
.
text_system
.
dt_boxes
]
}
}
return
res
return
res
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录