Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Serving
提交
da7bfe66
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看板
未验证
提交
da7bfe66
编写于
2月 09, 2021
作者:
T
TeslaZhao
提交者:
GitHub
2月 09, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1029 from TeslaZhao/v0.5.0
cherry-pick to PaddlePaddle/Serving:V0.5.0
上级
f663ebf7
5280a758
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
24 addition
and
22 deletion
+24
-22
doc/deprecated/IMDB_GO_CLIENT.md
doc/deprecated/IMDB_GO_CLIENT.md
+0
-0
doc/deprecated/IMDB_GO_CLIENT_CN.md
doc/deprecated/IMDB_GO_CLIENT_CN.md
+0
-0
doc/deprecated/MODEL_ENSEMBLE_IN_PADDLE_SERVING.md
doc/deprecated/MODEL_ENSEMBLE_IN_PADDLE_SERVING.md
+0
-0
doc/deprecated/MODEL_ENSEMBLE_IN_PADDLE_SERVING_CN.md
doc/deprecated/MODEL_ENSEMBLE_IN_PADDLE_SERVING_CN.md
+0
-0
doc/deprecated/NEW_OPERATOR.md
doc/deprecated/NEW_OPERATOR.md
+0
-0
doc/deprecated/NEW_OPERATOR_CN.md
doc/deprecated/NEW_OPERATOR_CN.md
+0
-0
python/examples/ocr/rec_web_server.py
python/examples/ocr/rec_web_server.py
+8
-12
python/paddle_serving_client/__init__.py
python/paddle_serving_client/__init__.py
+2
-2
python/pipeline/channel.py
python/pipeline/channel.py
+13
-7
python/pipeline/profiler.py
python/pipeline/profiler.py
+1
-1
未找到文件。
doc/IMDB_GO_CLIENT.md
→
doc/
deprecated/
IMDB_GO_CLIENT.md
浏览文件 @
da7bfe66
文件已移动
doc/IMDB_GO_CLIENT_CN.md
→
doc/
deprecated/
IMDB_GO_CLIENT_CN.md
浏览文件 @
da7bfe66
文件已移动
doc/MODEL_ENSEMBLE_IN_PADDLE_SERVING.md
→
doc/
deprecated/
MODEL_ENSEMBLE_IN_PADDLE_SERVING.md
浏览文件 @
da7bfe66
文件已移动
doc/MODEL_ENSEMBLE_IN_PADDLE_SERVING_CN.md
→
doc/
deprecated/
MODEL_ENSEMBLE_IN_PADDLE_SERVING_CN.md
浏览文件 @
da7bfe66
文件已移动
doc/NEW_OPERATOR.md
→
doc/
deprecated/
NEW_OPERATOR.md
浏览文件 @
da7bfe66
文件已移动
doc/NEW_OPERATOR_CN.md
→
doc/
deprecated/
NEW_OPERATOR_CN.md
浏览文件 @
da7bfe66
文件已移动
python/examples/ocr/rec_web_server.py
浏览文件 @
da7bfe66
...
...
@@ -43,25 +43,21 @@ class OCRService(WebService):
data
=
np
.
fromstring
(
data
,
np
.
uint8
)
im
=
cv2
.
imdecode
(
data
,
cv2
.
IMREAD_COLOR
)
img_list
.
append
(
im
)
feed_list
=
[]
max_wh_ratio
=
0
for
i
,
boximg
in
enumerate
(
img_list
):
h
,
w
=
boximg
.
shape
[
0
:
2
]
wh_ratio
=
w
*
1.0
/
h
max_wh_ratio
=
max
(
max_wh_ratio
,
wh_ratio
)
for
img
in
img_list
:
_
,
w
,
h
=
self
.
ocr_reader
.
resize_norm_img
(
img_list
[
0
],
max_wh_ratio
).
shape
imgs
=
np
.
zeros
((
len
(
img_list
),
3
,
w
,
h
)).
astype
(
'float32'
)
for
i
,
img
in
enumerate
(
img_list
):
norm_img
=
self
.
ocr_reader
.
resize_norm_img
(
img
,
max_wh_ratio
)
#feed = {"image": norm_img}
feed_list
.
append
(
norm_img
)
if
len
(
feed_list
)
==
1
:
feed_batch
=
{
"image"
:
np
.
concatenate
(
feed_list
,
axis
=
0
)[
np
.
newaxis
,
:]
}
else
:
feed_batch
=
{
"image"
:
np
.
concatenate
(
feed_list
,
axis
=
0
)}
imgs
[
i
]
=
norm_img
feed
=
{
"image"
:
imgs
.
copy
()}
fetch
=
[
"ctc_greedy_decoder_0.tmp_0"
,
"softmax_0.tmp_0"
]
return
feed
_batch
,
fetch
,
True
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_client/__init__.py
浏览文件 @
da7bfe66
...
...
@@ -198,12 +198,12 @@ class Client(object):
self
.
rpc_timeout_ms
=
rpc_timeout
def
use_key
(
self
,
key_filename
):
with
open
(
key_filename
,
"r"
)
as
f
:
with
open
(
key_filename
,
"r
b
"
)
as
f
:
self
.
key
=
f
.
read
()
def
get_serving_port
(
self
,
endpoints
):
if
self
.
key
is
not
None
:
req
=
json
.
dumps
({
"key"
:
base64
.
b64encode
(
self
.
key
)})
req
=
json
.
dumps
({
"key"
:
base64
.
b64encode
(
self
.
key
)
.
decode
()
})
else
:
req
=
json
.
dumps
({})
r
=
requests
.
post
(
"http://"
+
endpoints
[
0
],
req
)
...
...
python/pipeline/channel.py
浏览文件 @
da7bfe66
...
...
@@ -326,7 +326,10 @@ class ProcessChannel(object):
with
self
.
_cv
:
while
self
.
_stop
.
value
==
0
:
try
:
self
.
_que
.
put
({
op_name
:
channeldata
},
timeout
=
0
)
self
.
_que
.
put
((
channeldata
.
id
,
{
op_name
:
channeldata
}),
timeout
=
0
)
break
except
Queue
.
Full
:
self
.
_cv
.
wait
()
...
...
@@ -378,7 +381,7 @@ class ProcessChannel(object):
else
:
while
self
.
_stop
.
value
==
0
:
try
:
self
.
_que
.
put
(
put_data
,
timeout
=
0
)
self
.
_que
.
put
(
(
data_id
,
put_data
)
,
timeout
=
0
)
break
except
Queue
.
Empty
:
self
.
_cv
.
wait
()
...
...
@@ -414,7 +417,7 @@ class ProcessChannel(object):
with
self
.
_cv
:
while
self
.
_stop
.
value
==
0
and
resp
is
None
:
try
:
resp
=
self
.
_que
.
get
(
timeout
=
0
)
resp
=
self
.
_que
.
get
(
timeout
=
0
)
[
1
]
break
except
Queue
.
Empty
:
if
timeout
is
not
None
:
...
...
@@ -459,7 +462,7 @@ class ProcessChannel(object):
while
self
.
_stop
.
value
==
0
and
self
.
_consumer_cursors
[
op_name
]
-
self
.
_base_cursor
.
value
>=
len
(
self
.
_output_buf
):
try
:
channeldata
=
self
.
_que
.
get
(
timeout
=
0
)
channeldata
=
self
.
_que
.
get
(
timeout
=
0
)
[
1
]
self
.
_output_buf
.
append
(
channeldata
)
list_values
=
list
(
channeldata
.
values
())
_LOGGER
.
debug
(
...
...
@@ -633,7 +636,10 @@ class ThreadChannel(Queue.PriorityQueue):
with
self
.
_cv
:
while
self
.
_stop
is
False
:
try
:
self
.
put
({
op_name
:
channeldata
},
timeout
=
0
)
self
.
put
((
channeldata
.
id
,
{
op_name
:
channeldata
}),
timeout
=
0
)
break
except
Queue
.
Full
:
self
.
_cv
.
wait
()
...
...
@@ -680,7 +686,7 @@ class ThreadChannel(Queue.PriorityQueue):
else
:
while
self
.
_stop
is
False
:
try
:
self
.
put
(
put_data
,
timeout
=
0
)
self
.
put
(
(
data_id
,
put_data
)
,
timeout
=
0
)
break
except
Queue
.
Empty
:
self
.
_cv
.
wait
()
...
...
@@ -716,7 +722,7 @@ class ThreadChannel(Queue.PriorityQueue):
with
self
.
_cv
:
while
self
.
_stop
is
False
and
resp
is
None
:
try
:
resp
=
self
.
get
(
timeout
=
0
)
resp
=
self
.
get
(
timeout
=
0
)
[
1
]
break
except
Queue
.
Empty
:
if
timeout
is
not
None
:
...
...
python/pipeline/profiler.py
浏览文件 @
da7bfe66
...
...
@@ -120,7 +120,7 @@ class PerformanceTracer(object):
tot_cost
))
if
"DAG"
in
op_cost
:
calls
=
op_cost
[
"DAG"
].
values
(
)
calls
=
list
(
op_cost
[
"DAG"
].
values
()
)
calls
.
sort
()
tot
=
len
(
calls
)
qps
=
1.0
*
tot
/
self
.
_interval_s
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录