首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >在GPU上使用on运行时内存泄漏(CPU的RAM)

在GPU上使用on运行时内存泄漏(CPU的RAM)
EN

Stack Overflow用户
提问于 2021-07-15 15:25:59
回答 1查看 1.5K关注 0票数 1

我正在使用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内存)。

这是我的剧本:

代码语言:javascript
运行
复制
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

  • Nvidia驱动程序- 465.27

  • python - 3.6.9

  • insightface==0.3.8

  • mxnet==1.8.0.post0

  • mxnet-cu110==2.0.0a0

  • numpy==1.18.5

  • onnx==1.9.0

  • onnxruntime-gpu==1.8.1
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-07-15 19:14:17

I通过以下设置成功地解决了这个问题:

  • Ubuntu-20.04
  • Python-3.8
  • Nvidia-470
  • Cuda-11.3
  • Cudnn-8
  • mxnet==1.8.0.post0
  • onnx==1.9.0
  • onnxruntime-gpu==1.8.1
  • insightface==0.4
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68396613

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档