提交 6ee70ca0 编写于 作者: M MRXLT

update doc && code

上级 0692cc94
...@@ -13,7 +13,7 @@ PaddleServing是Paddle的在线预测服务框架,可以快速部署训练好 ...@@ -13,7 +13,7 @@ PaddleServing是Paddle的在线预测服务框架,可以快速部署训练好
```shell ```shell
pip install paddle_serving_server==0.3.2 #CPU pip install paddle_serving_server==0.3.2 #CPU
pip install paddle_serving_server_gpu==0.3.2.post9 #GPU with CUDA9.0 pip install paddle_serving_server_gpu==0.3.2.post9 #GPU with CUDA9.0
pip install paddle_serving_server_gpu==0.3.2.post9 #GPU with CUDA10.0 pip install paddle_serving_server_gpu==0.3.2.post10 #GPU with CUDA10.0
``` ```
客户端安装: 客户端安装:
...@@ -49,6 +49,10 @@ python pdseg/export_serving_model.py --cfg configs/unet_optic.yaml TEST.TEST_MOD ...@@ -49,6 +49,10 @@ python pdseg/export_serving_model.py --cfg configs/unet_optic.yaml TEST.TEST_MOD
分别将serving_server和serving_client复制到server和client启动的路径下。 分别将serving_server和serving_client复制到server和client启动的路径下。
本文中导出的unet模型示例[下载](https://paddle-serving.bj.bcebos.com/paddle_seg_demo/seg_unet_demo.tar.gz)
解压下载后的压缩包,可以得到seving_server和serving_client两个文件夹,用于以下步骤的测试。
## 4.部署预测服务 ## 4.部署预测服务
```shell ```shell
...@@ -62,3 +66,9 @@ python seg_client.py ../../dataset/optic_disc_seg/JPEGImages/N0060.jpg ...@@ -62,3 +66,9 @@ python seg_client.py ../../dataset/optic_disc_seg/JPEGImages/N0060.jpg
``` ```
脚本执行之后,会在输入图片所在的目录下生成处理后的图片 脚本执行之后,会在输入图片所在的目录下生成处理后的图片
示例中为`../../dataset/optic_disc_seg/JPEGImages/N0060_jpg_mask.png``../../dataset/optic_disc_seg/JPEGImages/N0060_jpg_result.png` 示例中为`../../dataset/optic_disc_seg/JPEGImages/N0060_jpg_mask.png``../../dataset/optic_disc_seg/JPEGImages/N0060_jpg_result.png`
如果需要使用其他模型进行预测,需要修改预处理部分和后处理部分。
本文中使用的是paddle_serving_app中内置的处理方法,用户可以参考导出模型时生成的deploy.yaml修改预处理部分。
后处理部分SegPostprocess初始化时接收的参数为分割的类别数。
...@@ -56,3 +56,4 @@ class SegPostprocess(object): ...@@ -56,3 +56,4 @@ class SegPostprocess(object):
fy=0, fy=0,
interpolation=cv2.INTER_CUBIC) interpolation=cv2.INTER_CUBIC)
cv2.imwrite(vis_result_name, result_png, [cv2.CV_8UC1]) cv2.imwrite(vis_result_name, result_png, [cv2.CV_8UC1])
return result_png
...@@ -22,4 +22,4 @@ filename = sys.argv[1] ...@@ -22,4 +22,4 @@ filename = sys.argv[1]
im = preprocess(filename) im = preprocess(filename)
fetch_map = client.predict(feed={"image": im}, fetch=["transpose_1.tmp_0"]) fetch_map = client.predict(feed={"image": im}, fetch=["transpose_1.tmp_0"])
fetch_map["filename"] = filename fetch_map["filename"] = filename
postprocess(fetch_map) result_png = postprocess(fetch_map)
# coding: utf8 # coding: utf8
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserve. # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserve.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册