I'm working in Google Colab and have already imported dlib
!pip install dlib
import dlib
and installed face_recognition module.
!pip install face_recognition
But, I'm getting error for this line:
import face_recognition
import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle
from matplotlib.patches import Circle
import numpy as np
import cv2
%matplotlib inline
The error is as follows:
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-159-91aca6eea0d3> in <module>()
----> 1 import face_recognition
2 import matplotlib.pyplot as plt
3 from matplotlib.patches import Rectangle
4 from matplotlib.patches import Circle
5 import numpy as np
1 frames
/usr/local/lib/python3.6/dist-packages/face_recognition/api.py in <module>()
24
25 cnn_face_detection_model = face_recognition_models.cnn_face_detector_model_location()
---> 26 cnn_face_detector = dlib.cnn_face_detection_model_v1(cnn_face_detection_model)
27
28 face_recognition_model = face_recognition_models.face_recognition_model_location()
RuntimeError: Error while calling cudaGetDevice(&the_device_id) in file /tmp/pip-wheel-66glv9rf/dlib/dlib/cuda/gpu_data.cpp:201. code: 100, reason: no CUDA-capable device is detected
What can be done?
From the error I can see you (probably) have not enabled GPU acceleration.
Go to Runtime -> Change Runtime -> Select GPU
Then Run the code !pip install face_recognition
This should install the library (and dependencies) without issue. Besides you don't need to install dlib separately. Let face_recognition build it alongside it.