You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`#coding=utf-8
from paddle_serving_server_gpu.web_service import WebService
from paddle_serving_app.reader import *
from PIL import Image
from io import BytesIO
import cv2
import numpy as np
import sys
import base64
环境docker 基于 hub.baidubce.com/paddlepaddle/serving latest-cuda10.0-cudnn7
同样代码在cpu环境下没有问题
其他版本信息
paddle-serving-app (0.2.0) paddle-serving-client (0.4.0) paddle-serving-server-gpu (0.4.0.post10) paddlepaddle-gpu (1.8.5.post107)
报错信息如下:
相关运行代码
python3 uwsgi.py
curl -H "Content-Type:application/json" -X POST -d '{"feed":[{"x": [0.0137, -0.1136, 0.2553, -0.0692, 0.0582, -0.0727, -0.1583, -0.0584, 0.6283, 0.4919, 0.1856, 0.0795, -0.0332]}], "fetch":["multiclass_nms_0.tmp_0"]}' http://127.0.0.1:9393/uci/prediction
`#coding=utf-8
from paddle_serving_server_gpu.web_service import WebService
from paddle_serving_app.reader import *
from PIL import Image
from io import BytesIO
import cv2
import numpy as np
import sys
import base64
preprocess = Sequential([
File2Image(), BGR2RGB(), Resize(
(608, 608), interpolation=cv2.INTER_LINEAR), Div(255.0), Transpose(
(2, 0, 1))
])
class UciService(WebService):
def preprocess(self, feed=[], fetch=[]):
print(feed)
#data = base64.b64decode(feed[0]["image"].encode('utf8'))
#data = np.fromstring(data, np.uint8)
#im = cv2.imdecode(data, cv2.IMREAD_COLOR)
#调用本地图片进行测试
car_im = preprocess("./22.jpg")
is_batch = True
print(car_im.shape)
print(np.array(list(car_im.shape[1:])).shape)
feed = [{
"image": car_im,
"im_size": np.array(list(car_im.shape[1:]))
}]
return feed, fetch, is_batch
def postprocess(self, feed={}, fetch=[], fetch_map=None):
print(fetch)
print(fetch_map)
return fetch
#配置预测服务
uci_service = UciService(name = "uci")
uci_service.load_model_config("./car_server")
uci_service.prepare_server(workdir="./workdir", port=9393, device="gpu", gpuid=0)
uci_service.run_rpc_service()
uci_service.run_web_service()
#获取flask服务
app_instance = uci_service.get_app_instance()
`
The text was updated successfully, but these errors were encountered: