[Serving] PaddleSeg add triton serving && simple serving example (#1171)

* Update keypointdetection result docs

* Update im.copy() to im in examples

* Update new Api, fastdeploy::vision::Visualize to fastdeploy::vision

* Update SwapBackgroundSegmentation && SwapBackgroundMatting to SwapBackground

* Update README_CN.md

* Update README_CN.md

* Update preprocessor.h

* PaddleSeg supports triton serving

* Add PaddleSeg simple serving example

* Add PaddleSeg triton serving client code

* Update triton serving runtime config.pbtxt

* Update paddleseg grpc client

* Add paddle serving README
This commit is contained in:
huangjianhui
2023-01-30 09:34:38 +08:00
committed by GitHub
parent 62e051e21d
commit 294607fc4a
17 changed files with 820 additions and 1 deletions

View File

@@ -0,0 +1,23 @@
import requests
import json
import cv2
import fastdeploy as fd
from fastdeploy.serving.utils import cv2_to_base64
if __name__ == '__main__':
url = "http://127.0.0.1:8000/fd/ppliteseg"
headers = {"Content-Type": "application/json"}
im = cv2.imread("cityscapes_demo.png")
data = {"data": {"image": cv2_to_base64(im)}, "parameters": {}}
resp = requests.post(url=url, headers=headers, data=json.dumps(data))
if resp.status_code == 200:
r_json = json.loads(resp.json()["result"])
result = fd.vision.utils.json_to_segmentation(r_json)
vis_im = fd.vision.vis_segmentation(im, result, weight=0.5)
cv2.imwrite("visualized_result.jpg", vis_im)
print("Visualized result save in ./visualized_result.jpg")
else:
print("Error code:", resp.status_code)
print(resp.text)