PaddleHub icon indicating copy to clipboard operation
PaddleHub copied to clipboard

hub serving start 的http demo是否存在内存泄漏的情况?

Open stoneLee81 opened this issue 2 years ago • 2 comments

服务器 :centos 跑的事咧:

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("/PATH/TO/IMAGE"))]}
headers = {"Content-type": "application/json"}
url = "http://127.0.0.1:8866/predict/chinese_ocr_db_crnn_mobile"
r = requests.post(url=url, headers=headers, data=json.dumps(data))

# 打印预测结果
print(r.json()["results"])

保存为test.py 启动 hub serving start --modules chinese_ocr_db_crnn_mobile 执行 python test.py 执行完毕,内存并没有释放掉,如果是执行 hub run chinese_ocr_db_crnn_mobile --input_path "" 命令,执行完毕,内存正常释放

stoneLee81 avatar Apr 14 '22 12:04 stoneLee81

你好,是显存还是内存呢?

KPatr1ck avatar Apr 15 '22 10:04 KPatr1ck

内存 @KPatr1ck

stoneLee81 avatar Apr 16 '22 02:04 stoneLee81