【问题标题】:Memory leak (CPU's RAM) when using onnxruntime on GPU在 GPU 上使用 onnxruntime 时的内存泄漏(CPU 的 RAM)
【发布时间】:2021-07-15 15:25:59
【问题描述】:

我正在使用 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')

我的设置是(在 docker 内):

  • Docker 基础镜像 - 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

【问题讨论】:

    标签: memory-leaks nvidia onnx onnxruntime


    【解决方案1】:

    我设法通过以下设置解决了这个问题:

    • 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

    【讨论】:

      猜你喜欢
      • 2021-12-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-10-09
      • 2021-04-30
      • 2012-01-17
      • 2015-09-14
      相关资源
      最近更新 更多