PaddleHub Serving GPU推理失败
Created by: xiaomujiang
欢迎您反馈PaddleHub使用问题,非常感谢您对PaddleHub的贡献! 在留下您的问题时,辛苦您同步提供如下信息:
- 版本、环境信息 1)PaddleHub和PaddlePaddle版本:请提供您的PaddleHub和PaddlePaddle版本号,例如PaddleHub1.4.1,PaddlePaddle1.6.2 2)系统环境:请您描述系统类型,例如Linux/Windows/MacOS/,python版本
- 复现信息:如为报错,请给出复现环境、复现步骤
PaddlePaddle 1.7.1 paddlehub==1.6.0 ubuntu export CUDA_VISIBLE_DEVICES=0 启动hub serving start -m yolov3_darknet53_coco2017 yolov3_darknet53_coco2017 == 1.1.1
- Serving Flask app "paddlehub.serving.app_single" (lazy loading)
- Environment: production WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
- Debug mode: off 2020-05-29 11:26:16,604-INFO: * Running on http://0.0.0.0:8866/ (Press CTRL+C to quit)
执行预测 import requests import json import cv2 import base64
def cv2_to_base64(image): data = cv2.imencode('.jpg', image)[1] return base64.b64encode(data.tostring()).decode('utf8')
发送HTTP请求
data = {'images':[cv2_to_base64(cv2.imread("1.jpg"))]} headers = {"Content-type": "application/json"} url = "http://127.0.0.1:8866/predict/yolov3_darknet53_coco2017" r = requests.post(url=url, headers=headers, data=json.dumps(data))
打印预测结果
print(r.json()["results"])
显示2秒多, 没有启动GPU推理, 请问还需要怎么设置?