Python面部识别中的CNN模型在正确安装dlib和cuda时会引发运行时错误

问题描述 投票:1回答:1

面部识别程序包有两个样本:https://github.com/ageitgey/face_recognition/blob/master/examples/find_faces_in_picture.pyhttps://github.com/ageitgey/face_recognition/blob/master/examples/find_faces_in_picture_cnn.py

[按照https://github.com/ageitgey/face_recognition#installation中的教程并在安装face_recognition之前从https://gist.github.com/ageitgey/629d75c1baac34dfa5ca2a1928a7aeaf中安装dlib(导入dlib起作用),提供的第一个链接中的代码示例工作正常:

import face_recognition

image = face_recognition.load_image_file("obama.jpg")

face_locations = face_recognition.face_locations(image)

top, right, bottom, left = face_locations[0]
face_image = image[top:bottom, left:right]
pil_image = Image.fromarray(face_image)
pil_image

但是,如果face_locations = face_recognition.face_locations(image)更改为face_locations = face_recognition.face_locations(image, model='cnn'),则会引发运行时错误:

RuntimeError: Error while calling cudnnSetConvolution2dDescriptor((cudnnConvolutionDescriptor_t)conv_handle, padding_y, padding_x, stride_y, stride_x, 1, 1, CUDNN_CROSS_CORRELATION) in file /tmp/pip-build-gl2dutj1/dlib/dlib/cuda/cudnn_dlibapi.cpp:826. code: 3, reason: CUDNN_STATUS_BAD_PARAM

https://github.com/ageitgey/face_recognition/issues/867 github问题描述了类似的问题,但没有解决方案。类似地,此https://github.com/natanielruiz/deep-head-pose/issues/7问题描述了类似的问题,但它表示仅从我所做的源构建。

dlib使用cuda作为

import dlib

dlib.DLIB_USE_CUDA

返回True。与Dlib (GPU supported) is not working properly, not sure?不同,即使重新启动jupyter内核(我系统上的64gb RAM,高度怀疑内存问题),它始终会引发此运行时错误。

python face-recognition dlib cudnn
1个回答
0
投票

我也使用face_recognition库进行人脸检测,并且在cnn模型中使用face_locations。但是我需要理论部分来解释这一部分,但我找不到任何可以帮助我的东西!谁能帮我!谢谢

© www.soinside.com 2019 - 2024. All rights reserved.