安装paddlepaddle 2.0.0rc0;Python 3.6.8;操作系统Centos7.9
执行:
[root@localhost /]# hub serving start -m chinese_ocr_db_crnn_server
W1201 14:42:49.340327 47935 analysis_predictor.cc:1042] Deprecated. Please use CreatePredictor instead.
chinese_ocr_db_crnn_server == 1.1.0
* 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
INFO:werkzeug: * Running on http://0.0.0.0:8866/ (Press CTRL+C to quit)
启动PaddleHub Serving成功,然后按文档写了一个测试:
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("/Images/Image2.jpg"))]}
headers = {"Content-type": "application/json"}
url = "http://127.0.0.1:8866/predict/chinese_ocr_db_crnn_server"
r = requests.post(url=url, headers=headers, data=json.dumps(data))
# 打印预测结果
print(r.json()["results"])
执行:
#python3 test1.py
PaddleHub Serving报错然后退出
/root/.paddlehub/modules/chinese_ocr_db_crnn_server/utils.py:188: DeprecationWarning: The binary mode of fromstring is deprecated, as it behaves surprisingly on unicode inputs. Use frombuffer instead
data = np.fromstring(data, np.uint8)
已杀死
这是什么问题啊?
你好,我这边是可以运行的
麻烦能把具体的错误贴一下吗?
显存不足?
楼主解决了么,我也遇到同样问题
同,遇到同样的问题
(paddle_env) D:\style_transfer\OCR>python remote_ocr.py
remote_ocr.py:9: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.
return base64.b64encode(data.tostring()).decode('utf8')
{'msg': 'Module chinese_ocr_db_crnn_server is not available.', 'results': '', 'status': '111'}
(paddle_env) D:\style_transfer\OCR>
同样的问题