我正在使用Pypi (https://pypi.org/project/insightface/)的Insightface库,源代码在这里:https://github.com/deepinsight/insightface/blob/master/python-package/insightface/model_zoo/scrfd.py。
当我在我的GPU上运行它时,CPU的RAM出现严重的内存泄漏,超过40 GB,直到我停止它(不是GPU内存)。
这是我的剧本:
import insightface
import cv2
import time
model = insightface.app.FaceAnalysis()
# It happens only when using GPU !!!
ctx_id = 0
image_path = "my-face-image.jpg"
image = cv2.imread(image_path)
model.prepare(ctx_id = ctx_id, det_thresh=0.3, det_size=[416, 416])
detector = model.models["detection"]
for i in range(100000):
start_t = time.time()
bboxes, landmarks = detector.detect(image)
end_t = time.time()
print('Detection time: {}'.format(end_t - start_t))
print('DONE')
我的设置是(在码头内):
nvidia/cuda:11.0.3-cudnn8-devel-ubuntu18.04
发布于 2021-07-15 19:14:17
I通过以下设置成功地解决了这个问题:
https://stackoverflow.com/questions/68396613
复制相似问题