davisking / dlib

A toolkit for making real world machine learning and data analysis applications in C++
http://dlib.net
Boost Software License 1.0
13.58k stars 3.38k forks source link

CUDA Runtime API initialization failed #1856

Closed jinduoxia closed 5 years ago

jinduoxia commented 5 years ago

Hi! My environment like follows:

when I run the code as follows:

detector = dlib.cnn_face_detection_model_v1('dogHeadDetector.dat')
predictor = dlib.shape_predictor('landmarkDetector.dat')

'''     Load Dog Image      '''
img_path = 'img/18.jpg'
filename, ext = os.path.splitext(os.path.basename(img_path))
img = cv2.imread(img_path)
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
# img = cv2.resize(img, dsize=None, fx=0.5, fy=0.5)

plt.figure(figsize=(16, 16))
plt.imshow(img)

'''     Detect Faces        '''
dets = detector(img, upsample_num_times=1)

It will get bug as follows:

Traceback (most recent call last):
  File "main.py", line 26, in <module>
    dets = detector(img, upsample_num_times=1)
RuntimeError: Error while calling cudnnCreate(&handles[new_device_id]) in file /data/code/cjh/dlib-19.12/dlib/cuda/cudnn_dlibapi.cpp:104. code: 1, reason: CUDA Runtime API initialization failed.

I had no trouble with CUDA and Pytorch works seamlessly. I really hope for help!

dlib-issue-bot commented 5 years ago

Warning: this issue has been inactive for 35 days and will be automatically closed on 2019-09-22 if there is no further activity.

If you are waiting for a response but haven't received one it's possible your question is somehow inappropriate. E.g. it is off topic, you didn't follow the issue submission instructions, or your question is easily answerable by reading the FAQ, dlib's official compilation instructions, dlib's API documentation, or a Google search.

dlib-issue-bot commented 5 years ago

Warning: this issue has been inactive for 43 days and will be automatically closed on 2019-09-22 if there is no further activity.

If you are waiting for a response but haven't received one it's possible your question is somehow inappropriate. E.g. it is off topic, you didn't follow the issue submission instructions, or your question is easily answerable by reading the FAQ, dlib's official compilation instructions, dlib's API documentation, or a Google search.

dlib-issue-bot commented 5 years ago

Notice: this issue has been closed because it has been inactive for 45 days. You may reopen this issue if it has been closed in error.