PaddleHub有哪些具体应用场景?

2026-06-09 13:378阅读0评论SEO教程
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计213个文字,预计阅读时间需要1分钟。

PaddleHub有哪些具体应用场景?

bash安装PaddlePaddle:pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple

安装PaddleHub:pip install paddlehub --upgrade -i https://pypi.tuna.tsinghua.edu.cn/simple

启动服务端:hub serving start -m chinese_ocr_db_crnn_mobile -p 5555

客户端安装依赖:pip install shapely py

  • pip install paddlepaddle -i mirror.baidu.com/pypi/simple
  • pip install paddlehub --upgrade -i pypi.tuna.tsinghua.edu.cn/simple
  • 服务端

hub serving start -m chinese_ocr_db_crnn_mobile -p 5555


  • 客户端

pip installshapely、pyclipper

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("2.jpg"))]}
headers = {"Content-type": "application/json"}
url = "gt.g.cn:5555/predict/chinese_ocr_db_crnn_mobile"
print(url)
r = requests.post(url=url, headers=headers, data=json.dumps(data))
print(r)
# 打印预测结果
print(r.json()["results"])




PaddleHub有哪些具体应用场景?


本文共计213个文字,预计阅读时间需要1分钟。

PaddleHub有哪些具体应用场景?

bash安装PaddlePaddle:pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple

安装PaddleHub:pip install paddlehub --upgrade -i https://pypi.tuna.tsinghua.edu.cn/simple

启动服务端:hub serving start -m chinese_ocr_db_crnn_mobile -p 5555

客户端安装依赖:pip install shapely py

  • pip install paddlepaddle -i mirror.baidu.com/pypi/simple
  • pip install paddlehub --upgrade -i pypi.tuna.tsinghua.edu.cn/simple
  • 服务端

hub serving start -m chinese_ocr_db_crnn_mobile -p 5555


  • 客户端

pip installshapely、pyclipper

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("2.jpg"))]}
headers = {"Content-type": "application/json"}
url = "gt.g.cn:5555/predict/chinese_ocr_db_crnn_mobile"
print(url)
r = requests.post(url=url, headers=headers, data=json.dumps(data))
print(r)
# 打印预测结果
print(r.json()["results"])




PaddleHub有哪些具体应用场景?