Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Serving
提交
02d96fbe
S
Serving
项目概览
PaddlePaddle
/
Serving
大约 1 年 前同步成功
通知
186
Star
833
Fork
253
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
105
列表
看板
标记
里程碑
合并请求
10
Wiki
2
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Serving
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
105
Issue
105
列表
看板
标记
里程碑
合并请求
10
合并请求
10
Pages
分析
分析
仓库分析
DevOps
Wiki
2
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
02d96fbe
编写于
12月 08, 2020
作者:
W
wangjiawei04
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix ocr
上级
eb08b056
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
11 addition
and
9 deletion
+11
-9
python/examples/ocr/det_debugger_server.py
python/examples/ocr/det_debugger_server.py
+3
-1
python/examples/ocr/ocr_debugger_server.py
python/examples/ocr/ocr_debugger_server.py
+6
-6
python/examples/ocr/rec_debugger_server.py
python/examples/ocr/rec_debugger_server.py
+1
-1
python/paddle_serving_server_gpu/web_service.py
python/paddle_serving_server_gpu/web_service.py
+1
-1
未找到文件。
python/examples/ocr/det_debugger_server.py
浏览文件 @
02d96fbe
...
...
@@ -53,7 +53,9 @@ class OCRService(WebService):
self
.
ori_h
,
self
.
ori_w
,
_
=
im
.
shape
det_img
=
self
.
det_preprocess
(
im
)
_
,
self
.
new_h
,
self
.
new_w
=
det_img
.
shape
return
{
"image"
:
det_img
[
np
.
newaxis
,
:].
copy
()},
[
"concat_1.tmp_0"
]
return
{
"image"
:
det_img
[
np
.
newaxis
,
:].
copy
()
},
[
"concat_1.tmp_0"
],
True
def
postprocess
(
self
,
feed
=
{},
fetch
=
[],
fetch_map
=
None
):
det_out
=
fetch_map
[
"concat_1.tmp_0"
]
...
...
python/examples/ocr/ocr_debugger_server.py
浏览文件 @
02d96fbe
...
...
@@ -42,10 +42,9 @@ class OCRService(WebService):
self
.
det_client
=
LocalPredictor
()
if
sys
.
argv
[
1
]
==
'gpu'
:
self
.
det_client
.
load_model_config
(
det_model_config
,
gpu
=
True
,
profile
=
False
)
det_model_config
,
use_gpu
=
True
,
gpu_id
=
1
)
elif
sys
.
argv
[
1
]
==
'cpu'
:
self
.
det_client
.
load_model_config
(
det_model_config
,
gpu
=
False
,
profile
=
False
)
self
.
det_client
.
load_model_config
(
det_model_config
)
self
.
ocr_reader
=
OCRReader
()
def
preprocess
(
self
,
feed
=
[],
fetch
=
[]):
...
...
@@ -58,7 +57,7 @@ class OCRService(WebService):
det_img
=
det_img
[
np
.
newaxis
,
:]
det_img
=
det_img
.
copy
()
det_out
=
self
.
det_client
.
predict
(
feed
=
{
"image"
:
det_img
},
fetch
=
[
"concat_1.tmp_0"
])
feed
=
{
"image"
:
det_img
},
fetch
=
[
"concat_1.tmp_0"
]
,
batch
=
True
)
filter_func
=
FilterBoxes
(
10
,
10
)
post_func
=
DBPostProcess
({
"thresh"
:
0.3
,
...
...
@@ -91,7 +90,7 @@ class OCRService(WebService):
imgs
[
id
]
=
norm_img
feed
=
{
"image"
:
imgs
.
copy
()}
fetch
=
[
"ctc_greedy_decoder_0.tmp_0"
,
"softmax_0.tmp_0"
]
return
feed
,
fetch
return
feed
,
fetch
,
True
def
postprocess
(
self
,
feed
=
{},
fetch
=
[],
fetch_map
=
None
):
rec_res
=
self
.
ocr_reader
.
postprocess
(
fetch_map
,
with_score
=
True
)
...
...
@@ -107,7 +106,8 @@ ocr_service.load_model_config("ocr_rec_model")
ocr_service
.
prepare_server
(
workdir
=
"workdir"
,
port
=
9292
)
ocr_service
.
init_det_debugger
(
det_model_config
=
"ocr_det_model"
)
if
sys
.
argv
[
1
]
==
'gpu'
:
ocr_service
.
run_debugger_service
(
gpu
=
True
)
ocr_service
.
set_gpus
(
"2"
)
ocr_service
.
run_debugger_service
()
elif
sys
.
argv
[
1
]
==
'cpu'
:
ocr_service
.
run_debugger_service
()
ocr_service
.
run_web_service
()
python/examples/ocr/rec_debugger_server.py
浏览文件 @
02d96fbe
...
...
@@ -52,7 +52,7 @@ class OCRService(WebService):
imgs
[
i
]
=
norm_img
feed
=
{
"image"
:
imgs
.
copy
()}
fetch
=
[
"ctc_greedy_decoder_0.tmp_0"
,
"softmax_0.tmp_0"
]
return
feed
,
fetch
return
feed
,
fetch
,
True
def
postprocess
(
self
,
feed
=
{},
fetch
=
[],
fetch_map
=
None
):
rec_res
=
self
.
ocr_reader
.
postprocess
(
fetch_map
,
with_score
=
True
)
...
...
python/paddle_serving_server_gpu/web_service.py
浏览文件 @
02d96fbe
...
...
@@ -250,7 +250,7 @@ class WebService(object):
from
paddle_serving_app.local_predict
import
LocalPredictor
self
.
client
=
LocalPredictor
()
self
.
client
.
load_model_config
(
"{}"
.
format
(
self
.
model_config
),
gpu
=
gpu
,
profile
=
False
)
"{}"
.
format
(
self
.
model_config
),
use_gpu
=
True
,
gpu_id
=
self
.
gpus
[
0
]
)
def
run_web_service
(
self
):
print
(
"This API will be deprecated later. Please do not use it"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录