Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleDetection
提交
cba0345d
P
PaddleDetection
项目概览
s920243400
/
PaddleDetection
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleDetection
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
cba0345d
编写于
12月 20, 2021
作者:
S
shangliang Xu
提交者:
GitHub
12月 20, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update serving to 0.7.0 (#4962)
上级
1818b132
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
174 addition
and
21 deletion
+174
-21
deploy/serving/README.md
deploy/serving/README.md
+90
-17
deploy/serving/label_list.txt
deploy/serving/label_list.txt
+80
-0
deploy/serving/test_client.py
deploy/serving/test_client.py
+4
-4
未找到文件。
deploy/serving/README.md
浏览文件 @
cba0345d
...
...
@@ -10,7 +10,7 @@ python tools/infer.py -c configs/yolov3/yolov3_darknet53_270e_coco.yml --infer_i
```
## 2. 安装 paddle serving
请参考
[
PaddleServing
](
https://github.com/PaddlePaddle/Serving/tree/v0.
6.0
)
中安装教程安装(版本>=0.6
.0)。
请参考
[
PaddleServing
](
https://github.com/PaddlePaddle/Serving/tree/v0.
7.0
)
中安装教程安装(版本>=0.7
.0)。
## 3. 导出模型
PaddleDetection在训练过程包括网络的前向和优化器相关参数,而在部署过程中,我们只需要前向参数,具体参考:
[
导出模型
](
https://github.com/PaddlePaddle/PaddleDetection/blob/develop/deploy/EXPORT_MODEL.md
)
...
...
@@ -41,7 +41,6 @@ output_inference
`serving_client`
文件夹下
`serving_client_conf.prototxt`
详细说明了模型输入输出信息
`serving_client_conf.prototxt`
文件内容为:
```
lient_conf.prototxt
feed_var {
name: "im_shape"
alias_name: "im_shape"
...
...
@@ -66,19 +65,17 @@ feed_var {
shape: 2
}
fetch_var {
name: "
save_infer_model/scale_0.tmp_1
"
alias_name: "
save_infer_model/scale_0.tmp_1
"
name: "
multiclass_nms3_0.tmp_0
"
alias_name: "
multiclass_nms3_0.tmp_0
"
is_lod_tensor: true
fetch_type: 1
shape: -1
}
fetch_var {
name: "
save_infer_model/scale_1.tmp_1
"
alias_name: "
save_infer_model/scale_1.tmp_1
"
is_lod_tensor:
tru
e
name: "
multiclass_nms3_0.tmp_2
"
alias_name: "
multiclass_nms3_0.tmp_2
"
is_lod_tensor:
fals
e
fetch_type: 2
shape: -1
}
```
## 4. 启动PaddleServing服务
...
...
@@ -94,16 +91,92 @@ python -m paddle_serving_server.serve --model serving_server --port 9393
```
## 5. 测试部署的服务
准备
`label_list.txt`
文件
准备
`label_list.txt`
文件
,示例
`label_list.txt`
文件内容为
```
# 进入到导出模型文件夹
cd output_inference/yolov3_darknet53_270e_coco/
# 将数据集对应的label_list.txt文件放到当前文件夹下
person
bicycle
car
motorcycle
airplane
bus
train
truck
boat
traffic light
fire hydrant
stop sign
parking meter
bench
bird
cat
dog
horse
sheep
cow
elephant
bear
zebra
giraffe
backpack
umbrella
handbag
tie
suitcase
frisbee
skis
snowboard
sports ball
kite
baseball bat
baseball glove
skateboard
surfboard
tennis racket
bottle
wine glass
cup
fork
knife
spoon
bowl
banana
apple
sandwich
orange
broccoli
carrot
hot dog
pizza
donut
cake
chair
couch
potted plant
bed
dining table
toilet
tv
laptop
mouse
remote
keyboard
cell phone
microwave
oven
toaster
sink
refrigerator
book
clock
vase
scissors
teddy bear
hair drier
toothbrush
```
设置
`prototxt`
文件路径为
`serving_client/serving_client_conf.prototxt`
。
设置
`fetch`
为
`fetch=["
save_infer_model/scale_0.tmp_1
"])`
设置
`prototxt`
文件路径为
`serving_client/serving_client_conf.prototxt`
设置
`fetch`
为
`fetch=["
multiclass_nms3_0.tmp_0
"])`
测试
```
...
...
@@ -111,5 +184,5 @@ cd output_inference/yolov3_darknet53_270e_coco/
cd output_inference/yolov3_darknet53_270e_coco/
# 测试代码 test_client.py 会自动创建output文件夹,并在output下生成`bbox.json`和`000000014439.jpg`两个文件
python ../../deploy/serving/test_client.py ../../demo/000000014439.jpg
python ../../deploy/serving/test_client.py ../../de
ploy/serving/label_list.txt ../../de
mo/000000014439.jpg
```
deploy/serving/label_list.txt
0 → 100644
浏览文件 @
cba0345d
person
bicycle
car
motorcycle
airplane
bus
train
truck
boat
traffic light
fire hydrant
stop sign
parking meter
bench
bird
cat
dog
horse
sheep
cow
elephant
bear
zebra
giraffe
backpack
umbrella
handbag
tie
suitcase
frisbee
skis
snowboard
sports ball
kite
baseball bat
baseball glove
skateboard
surfboard
tennis racket
bottle
wine glass
cup
fork
knife
spoon
bowl
banana
apple
sandwich
orange
broccoli
carrot
hot dog
pizza
donut
cake
chair
couch
potted plant
bed
dining table
toilet
tv
laptop
mouse
remote
keyboard
cell phone
microwave
oven
toaster
sink
refrigerator
book
clock
vase
scissors
teddy bear
hair drier
toothbrush
\ No newline at end of file
deploy/serving/test_client.py
浏览文件 @
cba0345d
...
...
@@ -23,21 +23,21 @@ preprocess = Sequential([
(
2
,
0
,
1
))
])
postprocess
=
RCNNPostprocess
(
"label_list.txt"
,
"output"
,
[
608
,
608
])
postprocess
=
RCNNPostprocess
(
sys
.
argv
[
1
]
,
"output"
,
[
608
,
608
])
client
=
Client
()
client
.
load_client_config
(
"serving_client/serving_client_conf.prototxt"
)
client
.
connect
([
'127.0.0.1:9393'
])
im
=
preprocess
(
sys
.
argv
[
1
])
im
=
preprocess
(
sys
.
argv
[
2
])
fetch_map
=
client
.
predict
(
feed
=
{
"image"
:
im
,
"im_shape"
:
np
.
array
(
list
(
im
.
shape
[
1
:])).
reshape
(
-
1
),
"scale_factor"
:
np
.
array
([
1.0
,
1.0
]).
reshape
(
-
1
),
},
fetch
=
[
"
save_infer_model/scale_0.tmp_1
"
],
fetch
=
[
"
multiclass_nms3_0.tmp_0
"
],
batch
=
False
)
print
(
fetch_map
)
fetch_map
[
"image"
]
=
sys
.
argv
[
1
]
fetch_map
[
"image"
]
=
sys
.
argv
[
2
]
postprocess
(
fetch_map
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录