windows下部署serving问题
Created by: liangruofei
我是在win10用anaconda安装了虚拟的paddle环境,然后把相应的包都安装了;在linux服务器端跑都没问题,运行程序如下:
`from paddle_serving_client import Client from paddle_serving_app.reader import * import numpy as np
preprocess = Sequential([ File2Image(), BGR2RGB(), Div(255.0), Normalize([0.385, 0.386, 0.375], [0.162, 0.159, 0.159], False), Resize(1000, 1500), Transpose((2, 0, 1)), PadStride(32) ]) client = Client() client.load_client_config("/home/aistudio/PaddleDetection-0.4/output/serving_model/cascade_rcnn_dcn_r50_vd_fpn_3x_server_side/serving_client/serving_client_conf.prototxt") client.connect(['127.0.0.1:9292']) im = preprocess('/home/aistudio/work/A/test014.jpg') fetch_map = client.predict(feed={"image": im, "im_info": np.array(list(im.shape[1:]) + [1.0]), "im_shape": np.array(list(im.shape[1:]) + [1.0])}, fetch=["multiclass_nms_0.tmp_0"]) fetch_map["image"] = '/home/aistudio/work/test.jpg' print (fetch_map)`
,但是在window下运行提示如下:
(paddlepaddle) D:\Desktop\serving>python test2.py Traceback (most recent call last): File "test2.py", line 10, in client = Client() File "D:\Anaconda3\envs\paddlepaddle\lib\site-packages\paddle_serving_client_init_.py", line 136, in init from .serving_client import PredictorRes ModuleNotFoundError: No module named 'paddle_serving_client.serving_client'
然后,我根据你们提供的新平台支持修改了程序如下:
`from paddle_serving_client import MultiLangClient as Client from paddle_serving_app.reader import * import numpy as np
preprocess = Sequential([ File2Image(), BGR2RGB(), Div(255.0), Normalize([0.385, 0.386, 0.375], [0.162, 0.159, 0.159], False), Resize(1000, 1500), Transpose((2, 0, 1)), PadStride(32) ]) client = Client() client.load_client_config("serving_client/serving_client_conf.prototxt") client.connect(['127.0.0.1:9292']) im = preprocess('/home/aistudio/work/A/test001.jpg') fetch_map = client.predict(feed={"image": im, "im_info": np.array(list(im.shape[1:]) + [1.0]), "im_shape": np.array(list(im.shape[1:]) + [1.0])}, fetch=["multiclass_nms_0.tmp_0"]) fetch_map["image"] = '/home/aistudio/work/test001.jpg' print (fetch_map)`
报错如下:
(paddlepaddle) D:\Desktop\serving>python test3.py Traceback (most recent call last): File "test3.py", line 12, in <module> client.load_client_config("serving_client/serving_client_conf.prototxt") AttributeError: 'MultiLangClient' object has no attribute 'load_client_config'