客户端调用 from .serving_client import PredictorClient 报错
Created by: omtbreak
本机系统MaxOS,使用的 paddle_serving_client-0.2.2-py3-none-any.whl
from paddle_serving_client import Client
from paddle_serving_app.reader import *
import sys
import numpy as np
preprocess = Sequential([
File2Image(), BGR2RGB(), Div(255.0),
Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225], False),
Resize(640, 640), Transpose((2, 0, 1))
])
postprocess = RCNNPostprocess("/Users/omtbreak/Desktop/untitled1/label_list.txt", "output")
client = Client()
client.load_client_config("/Users/omtbreak/Desktop/serving_client_conf.prototxt")
client.connect(['122.5.106.226:7788'])
im = preprocess('/Users/omtbreak/Desktop/000000570688.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"])
fetch_map["image"] = '/Users/omtbreak/Desktop/000000570688.jpg'
postprocess(fetch_map)
print(fetch_map)
模型开启在Ubuntu18,客户端调用代码报错
File "/Users/omtbreak/Desktop/untitled1/test_client.py", line 15, in <module>
client.load_client_config("/Users/omtbreak/Desktop/serving_client_conf.prototxt")
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/paddle_serving_client/__init__.py", line 129, in load_client_config
from .serving_client import PredictorClient
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/paddle_serving_client/serving_client.so, 2): no suitable image found. Did find:
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/paddle_serving_client/serving_client.so: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x03
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/paddle_serving_client/serving_client.so: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x03