Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Serving
提交
c3c592c4
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看板
未验证
提交
c3c592c4
编写于
7月 14, 2020
作者:
D
Dong Daxiang
提交者:
GitHub
7月 14, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' into fix-dockerfile
上级
bd328d88
f3a1f9a1
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
106 addition
and
12 deletion
+106
-12
python/examples/imagenet/benchmark_batch.py.lprof
python/examples/imagenet/benchmark_batch.py.lprof
+0
-0
python/examples/imagenet/test_image_reader.py
python/examples/imagenet/test_image_reader.py
+37
-0
python/paddle_serving_app/reader/image_reader.py
python/paddle_serving_app/reader/image_reader.py
+16
-1
tools/serving_build.sh
tools/serving_build.sh
+53
-11
未找到文件。
python/examples/imagenet/benchmark_batch.py.lprof
已删除
100644 → 0
浏览文件 @
bd328d88
文件已删除
python/examples/imagenet/test_image_reader.py
0 → 100644
浏览文件 @
c3c592c4
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from
paddle_serving_app.reader.image_reader
import
String2Image
,
Base64ToImage
,
Sequential
import
base64
def
test_String2Image
():
with
open
(
"./daisy.jpg"
)
as
f
:
img_str
=
f
.
read
()
seq
=
Sequential
([
String2Image
()])
img
=
seq
(
img_str
)
assert
(
img
.
shape
==
(
563
,
500
,
3
))
def
test_Base64ToImage
():
with
open
(
"./daisy.jpg"
)
as
f
:
img_str
=
f
.
read
()
seq
=
Sequential
([
Base64ToImage
()])
img
=
seq
(
base64
.
b64encode
(
img_str
))
assert
(
img
.
shape
==
(
563
,
500
,
3
))
if
__name__
==
"__main__"
:
test_String2Image
()
test_Base64ToImage
()
python/paddle_serving_app/reader/image_reader.py
浏览文件 @
c3c592c4
...
...
@@ -517,6 +517,19 @@ class BGR2RGB(object):
return
self
.
__class__
.
__name__
+
"()"
class
String2Image
(
object
):
def
__init__
(
self
):
pass
def
__call__
(
self
,
img_buffer
):
data
=
np
.
fromstring
(
img_buffer
,
np
.
uint8
)
img
=
cv2
.
imdecode
(
data
,
cv2
.
IMREAD_COLOR
)
return
img
def
__repr__
(
self
):
return
self
.
__class__
.
__name__
+
"()"
class
File2Image
(
object
):
def
__init__
(
self
):
pass
...
...
@@ -561,7 +574,9 @@ class Base64ToImage(object):
pass
def
__call__
(
self
,
img_base64
):
img
=
base64
.
b64decode
(
img_base64
)
sample
=
base64
.
b64decode
(
img_base64
)
data
=
np
.
fromstring
(
sample
,
np
.
uint8
)
img
=
cv2
.
imdecode
(
data
,
cv2
.
IMREAD_COLOR
)
return
img
def
__repr__
(
self
):
...
...
tools/serving_build.sh
浏览文件 @
c3c592c4
...
...
@@ -61,7 +61,7 @@ function build_app() {
-DPYTHON_LIBRARIES
=
$PYTHONROOT
/lib/libpython2.7.so
\
-DPYTHON_EXECUTABLE
=
$PYTHONROOT
/bin/python
\
-DAPP
=
ON ..
rerun
"make -j
2
>/dev/null"
3
# due to some network reasons, compilation may fail
rerun
"make -j
10
>/dev/null"
3
# due to some network reasons, compilation may fail
pip
install
-U
python/dist/paddle_serving_app
*
>
/dev/null
;;
*
)
...
...
@@ -84,7 +84,7 @@ function build_client() {
-DPYTHON_LIBRARIES
=
$PYTHONROOT
/lib64/libpython2.7.so
\
-DPYTHON_EXECUTABLE
=
$PYTHONROOT
/bin/python
\
-DCLIENT
=
ON ..
rerun
"make -j
2
>/dev/null"
3
# due to some network reasons, compilation may fail
rerun
"make -j
10
>/dev/null"
3
# due to some network reasons, compilation may fail
pip
install
-U
python/dist/paddle_serving_client
*
>
/dev/null
;;
*
)
...
...
@@ -108,7 +108,7 @@ function build_server() {
-DPYTHON_LIBRARIES
=
$PYTHONROOT
/lib64/libpython2.7.so
\
-DPYTHON_EXECUTABLE
=
$PYTHONROOT
/bin/python
\
-DSERVER
=
ON ..
rerun
"make -j
2
>/dev/null"
3
# due to some network reasons, compilation may fail
rerun
"make -j
10
>/dev/null"
3
# due to some network reasons, compilation may fail
check_cmd
"make install -j2 >/dev/null"
pip
install
-U
python/dist/paddle_serving_server
*
>
/dev/null
;;
...
...
@@ -118,7 +118,7 @@ function build_server() {
-DPYTHON_EXECUTABLE
=
$PYTHONROOT
/bin/python
\
-DSERVER
=
ON
\
-DWITH_GPU
=
ON ..
rerun
"make -j
2
>/dev/null"
3
# due to some network reasons, compilation may fail
rerun
"make -j
10
>/dev/null"
3
# due to some network reasons, compilation may fail
check_cmd
"make install -j2 >/dev/null"
pip
install
-U
python/dist/paddle_serving_server
*
>
/dev/null
;;
...
...
@@ -643,13 +643,7 @@ function python_test_yolov4(){
cd
yolov4
case
$TYPE
in
CPU
)
python
-m
paddle_serving_app.package
--get_model
yolov4
tar
-xzvf
yolov4.tar.gz
check_cmd
"python -m paddle_serving_server.serve --model yolov4_model/ --port 9393 &"
sleep
5
check_cmd
"python test_client.py 000000570688.jpg"
echo
"yolov4 CPU RPC inference pass"
kill_server_process
echo
"no implement for cpu type"
;;
GPU
)
python
-m
paddle_serving_app.package
--get_model
yolov4
...
...
@@ -670,6 +664,53 @@ function python_test_yolov4(){
cd
..
}
function
python_test_resnet50
(){
#pwd:/ Serving/python/examples
local
TYPE
=
$1
export
SERVING_BIN
=
${
SERVING_WORKDIR
}
/build-server-
${
TYPE
}
/core/general-server/serving
cd
imagenet
case
$TYPE
in
CPU
)
echo
"no implement for cpu type"
;;
GPU
)
sh get_model.sh
check_cmd
"python -m paddle_serving_server_gpu.serve --model ResNet50_vd_model --port 9696 --gpu_ids 0"
sleep
5
check_cmd
"python resnet50_rpc_client.py ResNet50_vd_client_config/serving_client_conf.prototxt"
echo
"resnet50 GPU RPC inference pass"
kill_server_process
;;
*
)
echo
"error type"
exit
1
;;
esac
echo
"test resnet
$TYPE
finished as expected"
unset
SERVING_BIN
cd
..
}
function
python_app_api_test
(){
#pwd:/ Serving/python/examples
#test image reader
local
TYPE
=
$1
cd
imagenet
case
$TYPE
in
CPU
)
check_cmd
"python test_image_reader.py"
;;
GPU
)
echo
"no implement for cpu type"
;;
*
)
echo
"error type"
exit
1
;;
esac
echo
"test app api finised as expected"
cd
..
}
function
python_run_test
()
{
# Using the compiled binary
...
...
@@ -684,6 +725,7 @@ function python_run_test() {
python_test_multi_fetch
$TYPE
# pwd: /Serving/python/examples
python_test_yolov4
$TYPE
# pwd: /Serving/python/examples
python_test_grpc_impl
$TYPE
# pwd: /Serving/python/examples
python_test_resnet50
$TYPE
# pwd: /Serving/python/examples
echo
"test python
$TYPE
part finished as expected."
cd
../..
# pwd: /Serving
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录