(assuming that conda and/or miniconda are already installed)
-
Create a conda environment with a few packages initialized.
conda create -n faces python=3.6 cudatoolkit cudnn cmake numpy ipython
-
Activate the environment.
conda activate faces
-
Download and build dlib from source, following https://www.pyimagesearch.com/2018/06/18/face-recognition-with-opencv-python-and-deep-learning/. Notice that the last python setup.py step is changed...
$ git clone https://github.com/davisking/dlib.git $ cd dlib $ mkdir build $ cd build $ cmake .. -DDLIB_USE_CUDA=1 -DUSE_AVX_INSTRUCTIONS=1 $ cmake --build . $ cd .. $ python setup.py install --set DLIB_USE_CUDA=1
-
Install face_recognition python library
pip install face_recognition
-
Test it out using ipython
(faces) [triznam@NMNH-30914 dlib]$ ipython Python 3.6.8 |Anaconda, Inc.| (default, Dec 30 2018, 01:22:34) Type 'copyright', 'credits' or 'license' for more information IPython 7.3.0 -- An enhanced Interactive Python. Type '?' for help. In [1]: import dlib In [2]: dlib.DLIB_USE_CUDA Out[2]: True In [3]: print(dlib.cuda.get_num_devices()) 1