通过下载blazeface模型,进行服务端部署,客户端报错,请问是什么问题?
Created by: vinceyzw
1、下载blazeface模型 https://paddlemodels.bj.bcebos.com/object_detection/blazeface_original.tar 2、Paddle Serving部署模型导出 python tools/export_serving_model.py 3、启动服务端服务 python -m paddle_serving_server.serve --model serving_model --thread 2 --port 9000 --name detect 4、客户端运行报错 def cv2_to_base64(image): data = cv2.imencode('.jpg', image)[1] return base64.b64encode(data.tostring()).decode('utf8') input_path = "../../work/test3.jpg" data = {'images':[cv2_to_base64(cv2.imread(str(input_path)))]} headers = {"Content-type": "application/json"} url = "http://127.0.0.1:9000/predict/detect" r = requests.post(url=url, headers=headers, data=json.dumps(data))
================ Traceback (most recent call last): File "blazeface.py", line 14, in r = requests.post(url=url, headers=headers, data=json.dumps(data), timeout=None) File "/usr/lib/python2.7/site-packages/requests/api.py", line 119, in post return request('post', url, data=data, json=json, **kwargs) File "/usr/lib/python2.7/site-packages/requests/api.py", line 61, in request return session.request(method=method, url=url, **kwargs) File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 530, in request resp = self.send(prep, **send_kwargs) File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 643, in send r = adapter.send(request, **kwargs) File "/usr/lib/python2.7/site-packages/requests/adapters.py", line 516, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=9000): Max retries exceeded with url: /predict/detect (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fa88667c410>: Failed to establish a new connection: [Errno 111] Connection refused',))