首页 PaddleOCR 帖子详情
PaddleOCR测试报错
收藏
快速回复
PaddleOCR 问答OCR 4570 6
PaddleOCR测试报错
收藏
快速回复
PaddleOCR 问答OCR 4570 6

安装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)
已杀死

这是什么问题啊?

0
收藏
回复
全部评论(6)
时间顺序
thinc
#2 回复于2020-12

你好,我这边是可以运行的

> python test.py
test.py:9: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.
  return base64.b64encode(data.tostring()).decode('utf8')
[{'data': [{'confidence': 0.988315224647522, 'text': '邦佳洗衣', 'text_box_position': [[3, 0], [207, 3], [207, 43], [3, 40]]}], 'save_path': ''}]
0
回复
thinc
#3 回复于2020-12

麻烦能把具体的错误贴一下吗?

0
回复
夜雨飘零1
#4 回复于2020-12

显存不足?

0
回复
F
FreeRalph
#6 回复于2020-12

楼主解决了么,我也遇到同样问题

0
回复
一_
#7 回复于2021-07

同,遇到同样的问题

0
回复
t
triumphcc
#8 回复于2023-04

(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>

同样的问题

0
回复
需求/bug反馈?一键提issue告诉我们
发现bug?如果您知道修复办法,欢迎提pr直接参与建设飞桨~
在@后输入用户全名并按空格结束,可艾特全站任一用户