[Face key point detection] Dlib installation

introduction

The dlib library is a python library for facial key point detection, but because it is written in C++ (or does it need to be compiled in C++?), we encounter various problems during installation. The author encountered different problems when installing on different computers, but after searching, they were all solved. Therefore, I will summarize the method of installing the dlib library by myself, hoping to help everyone.

Method 1: Anaconda installation

After installing Anaconda, first enter at the command line:

anaconda search -t conda dlib

Used to search for available dlib versions; then type:

conda install -c https://conda.anaconda.org/conda-forge dlib

Method 2: Install Cmake

This installation method mainly refers to the personal blog of the blogger Mitu Xiaoshutong. For the specific installation method, please refer to the link:
https://xugaoxiang.com/2021/05/20/windows-pip-install-dlib/

By default, if you execute pip install dlib to install, an error will occur

This is because there is a lack of cmake compilation tools in the system. We came to the official download address of cmake https://cmake.org/download/, and installed it in a fool-like way. Of course, the C++ components in Visual Studio also need to be installed. Finally, execute install command

pip install dlib

If there are still errors during the installation process, and the python version is 3.7 or 3.8, you can go to the address https://github.com/RvTechiNNovate/face_recog_dlib_file to download the whl file and install it directly

pip install *.whl

Accelerate with CUDA

If CUDA is already installed on the system, dlib installed via pip will use CUDA acceleration. Can be checked by the following script

import dlib
dlib.DLIB_USE_CUDA

If the return value is False, it means that CUDA is not enabled. At this time, you can uninstall the previous version and download the source code of dlib. The address is https://github.com/davisking/dlib/releases/tag/v19.22

After decompression, enter the directory and execute

python setup.py install --set DLIB_USE_CUDA=1

Then pay attention to see if there is a statement like DLIB_USE_CUDA in the printed information during the installation process

Method 3: Download the whl file and install it

https://github.com/RvTechiNNovate/face_recog_dlib_file

pip install cmake

Open the terminal in the folder where it is located. If the python version is 3.7, enter the following command to install:

pip install dlib-19.19.0-cp37-cp37m-win_amd64.whl

Reference link: https://blog.csdn.net/qq_43466323/article/details/120855699

Guess you like

Origin blog.csdn.net/qq_40507857/article/details/129166487