i3587616 2021-09-20 22:07 采纳率: 0%
浏览 236
已结题

dlib调.cnn_face_detection_model_v1提示reason: CUDA Resources could not be allocated.

笔记本电脑,显卡为mx450 2G独显,现在出问题了。代码

import os 
import face_recognition
import time

time_start=time.time() 

gilr_image = face_recognition.load_image_file("suzy.jpg")
girl_encoding = face_recognition.face_encodings(gilr_image)[0]

'''
img = face_recognition.load_image_file("temp/frame000119.jpg")
locations = face_recognition.face_locations(img,model="cnn")
for l in locations:
    print(l)
face_encodings = face_recognition.face_encodings(img,known_face_locations=locations)
results = face_recognition.compare_faces(face_encodings, girl_encoding)
for rsl in results:
    print(rsl)
'''
img1 = face_recognition.load_image_file("temp/frame000059.jpg")
img2 = face_recognition.load_image_file("temp/frame000120.jpg")
img = []
img.append(img1)
img.append(img2)
batch_of_face_locations = face_recognition.batch_face_locations(img, number_of_times_to_upsample=1,batch_size=2)

这里number_of_times_to_upsample设为0就没事,设为1 就报
return cnn_face_detector(images, number_of_times_to_upsample, batch_size=batch_size)
RuntimeError: Error while calling cudnnFindConvolutionForwardAlgorithm( context(), descriptor(data), (const cudnnFilterDescriptor_t)filter_handle, (const cudnnConvolutionDescriptor_t)conv_handle, descriptor(dest_desc), num_possible_algorithms, &num_algorithms, perf_results.data()) in file G:\dlib-19.22\dlib\cuda\cudnn_dlibapi.cpp:820. code: 2, reason: CUDA Resources could not be allocated.

另一个主要代码是 batch_of_face_locations = face_recognition.batch_face_locations(frames, number_of_times_to_upsample=0)#batch_size=128默认。这里报Out of memory 。这个我看了一会源代码了,python的dlib只看到了api,不知道python部分源代码在哪

class dlib.cnn_face_detection_model_v1
This object detects human faces in an image. The constructor loads the face detection model from a file. You can download a pre-trained model from http://dlib.net/files/mmod_human_face_detector.dat.bz2.

__call__(*args, **kwargs)
Overloaded function.

__call__(self: dlib.cnn_face_detection_model_v1, imgs: list, upsample_num_times: int=0L, batch_size: int=128L) -> std::vector<std::vector<dlib::mmod_rect, std::allocator<dlib::mmod_rect> >, std::allocator<std::vector<dlib::mmod_rect, std::allocator<dlib::mmod_rect> > > >
takes a list of images as input returning a 2d list of mmod rectangles

__call__(self: dlib.cnn_face_detection_model_v1, img: array, upsample_num_times: int=0L) -> std::vector<dlib::mmod_rect, std::allocator<dlib::mmod_rect> >
Find faces in an image using a deep learning model.
Upsamples the image upsample_num_times before running the face detector.
__init__(self: dlib.cnn_face_detection_model_v1, filename: unicode) → None

不知道这api源代码在哪,C++部分这么关联上,以前做JAVA的,所以我也不懂它这里面是这么扩展的,我觉得没多少数据啊,
这么装不下,是不是我要加上什么设置啊。有懂的帮 帮我吧

  • 写回答

3条回答 默认 最新

  • i3587616 2021-09-20 22:11
    关注

    懂的帮帮我吧,这个懂应该很简单吧,我是不是少了什么设置。batch_size我想要默认的128而不是2。

    评论

报告相同问题?

问题事件

  • 系统已结题 9月28日
  • 创建了问题 9月20日

悬赏问题

  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器