Nettraffic для windows 10 официальный сайт

Last Updated :
17 Jul, 2022

In this article, We are going to know how to install dlib library for Python in windows 10.

Dlib is one of the most powerful and easy-to-go open-source library consisting of machine learning library/algorithms and various tools for creating software. It was initially released in 2002. It has been used widely in many big industries, companies and for various big projects, etc. It also has many more types of algorithms that have a greater role in the real world.
Dlib is mostly used for face recognition purposes. They analyzed the object/face using the functions called HOG (Histogram of oriented gradients) and CNN (Convolutional Neural Networks). Face recognition nowadays are been used widely in many applications.

How to install dlib library.

First of all we have to set up the environment for the installation of dlib library. There are a few things that should be pre-installed before installing the dlib library. If these things aren’t properly installed or set up the dlib will not get installed properly. Let us see how we can do it.

Step 1: Install Python

Install Python on Windows. and after that to check whether Python is properly installed or not check the python version using the below command.

Python Installed Successfully

Step 2: Install CMake

Install CMake from its official website https://cmake.org/download/ and make sure choose the right version according to your system configuration.

While installing CMake select Add CMake to the system PATH to avoid any error in the next steps. 

Step 3: Install visual studio.

Install the c++ compiler of the visual studio code community version. For that go to the visual studio code official website https://visualstudio.microsoft.com/visual-cpp-build-tools/  and download the visual studio code community version after that as you can see in the below image, select Desktop development with c++ while installing VS code.

Installing Desktop development with c++

Step 4: Install cmake module.

After you have installed visual studio [Desktop development with c++] successfully, now go to your command prompt and type “pip install cmake”

install cmake

Step 5: Install dlib library.

After you have installed cmake module successfully, go ahead and install the dlib library as shown in below image.

install dlib

Now, the dlib library is installed successfully and to verify the installation of dlib library open command prompt and type the command as shown in the below image.

Verify dlib installation.

In the above code, we are importing dlib library and it is successfully imported without giving any error on the other hand “import numpy” gives an error because NumPy is not installed on the system.

Download wheel file to install dlib here

YT: Data Magic AI

Dlib is a modern C++ toolkit that contains machine learning algorithms and tools for creating complex software in C++. this libraries Python version is also available which wraps up this c++ dlib.

It provides a variety of algorithms for face detection, face landmark detection, object tracking, pose estimation, and image processing. One of the main strengths of dlib is its ability to work efficiently with both CPU and GPU. Dlib also has Python bindings, which makes it easy to use in Python.

Dlib is widly used for Face recognition, Object detection and tracking, Image segmentation, Landmark, augmented reality, facial expression analysis, and gesture recognition etc.

Overall, dlib is a versatile and powerful library that can be used in a wide range of applications that require advanced computer vision and machine learning algorithms.

Install dlib is not easy task:

There is high chance that you will come across below CMAKE error,

Installing dlib is not easy task:

--Building for: NMake Makefiles 

-- The C compiler identification is unknown 

-- The CXX compiler identification is unknown 

CMake Error in CMakeLists.txt: T

he CMAKE_C_COMPILER: cl is not a full path and was not found in the PATH. 

To use the NMake generator with Visual C++, cmake must be run from a shell that can use the compiler cl from the command line. This environment is unable to invoke the cl compiler. To fix this problem, run cmake from the Visual Studio Command Prompt (vcvarsall.bat). 

Tell CMake where to find the compiler by setting either the environment variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to the compiler, or to the compiler name if it is in the PATH. 

CMake Error in CMakeLists.txt: The CMAKE_CXX_COMPILER: cl is not a full path and was not found in the PATH. To use the NMake generator with Visual C++, cmake must be run from a shell that can use the compiler cl from the command line. This environment is unable to invoke the cl compiler. 

To fix this problem, run cmake from the Visual Studio Command Prompt (vcvarsall.bat). 

Tell CMake where to find the compiler by setting either the environment variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path to the compiler, or to the compiler name if it is in the PATH. 

-- Configuring incomplete, errors occurred!

Solution:

Install dlib with wheel file.

  • download wheel file here
  • Extract the downloaded file
  • open command prompt on windows
  • cd <extracted folder path>
  • pip install dlib-19.19.0-cp37-cp37m-win_amd64.whl

If you are unable to follow any steps then please go through the video tutorial.

If you want to install dlib on python 3.6 and below version then use this link to download wheel file.

How to Install dlib on Python 3.10

How to Install dlib on Python 3.9

How to Install dlib on Python 3.8

Dlib compiled binary wheels for Python 3.7 — 3.12 on Windows and x64 CPUs

This repository contains the compiled binary (.whl) files for the Dlib library to install on Python versions 3.7, 3.8, 3.9, 3.10, 3.11, and 3.12 on a Windows x64 OS.

📢 New Update:

  • May 08, 2024: Added compiled binary file (.whl) for Python 3.12!

Steps to install Dlib:

  • Install Python from Python.org (download the 64-bit installer file)

    OR

  • Create a virtual environment via venv or Anaconda i.e. conda create -n env_name python = 3.8

  • Download the wheel file for your specific Python version

  • Open a terminal and install Dlib via:

Python 3.7

python -m pip install dlib-19.22.99-cp37-cp37m-win_amd64.whl 

Python 3.8

python -m pip install dlib-19.22.99-cp38-cp38-win_amd64.whl

Python 3.9

python -m pip install dlib-19.22.99-cp39-cp39-win_amd64.whl

Python 3.10

python -m pip install dlib-19.22.99-cp310-cp310-win_amd64.whl

Python 3.11

python -m pip install dlib-19.24.1-cp311-cp311-win_amd64.whl

Python 3.12

python -m pip install dlib-19.24.99-cp312-cp312-win_amd64.whl

Steps to build Dlib from source:

If you’d like to build it from source, follow these exact steps as per their docs:

  • Install Visual Studio 2022 with the option Desktop Development with C++
  • Create a virtual env with venv or anaconda
  • Execute these commands:
git clone https://github.com/davisking/dlib.git
cd dlib
pip install build
python -m build --wheel # Upon successful run, a ".whl" binary will be created under "dlib/dist/" 
pip install dist/dlib-<version>.whl # replace <version> with the exact name of the ".whl" file

Cheers!

Install Dlib on Windows

In this post, we will provide step by step instructions on how to install Dlib on Windows.

Please use the official instructions to use Dlib in your project. This post is no longer updated or maintained.

Compiling Python modules such as NumPy, SciPy etc. is a tedious task. Anaconda is a great Python distribution which comes with a lot of pre-compiled Python packages. So we will use Anaconda as our Python distribution.

An alternative to Anaconda is that you install official Python library and use Christoph Gohlke’s awesome repository to install pre-compiled Python modules.

This tutorial is based on using Anaconda so we may not be able to help if you choose to use Gohlke’s precompiled binaries or if you compile Python libraries from source.

If you intend to use Dlib only in C++ projects, you can skip Python installation part.

Now let’s go through the steps to install Dlib. Follow our previous post Install OpenCV3 on Windows to complete Step 1, 2 and 3.

Step 1: Install Visual Studio 2015

Step 2: Install CMake v3.8.2

Step 3: Install Anaconda 3

Step 4: Download Dlib

Download Dlib v19.6 from http://dlib.net/files/dlib-19.6.zip

Step 5: Build Dlib library

Extract this compressed file. Open Windows PowerShell or Command Prompt and move to the directory where you have extracted this file.

If you are running these commands on Command Prompt replace ` (backtick) with ^ (caret).

cd dlib-19.6\
mkdir build
cd build

# This is a single command. Backticks are used for line continuation
cmake -G "Visual Studio 14 2015 Win64" `
-DJPEG_INCLUDE_DIR=..\dlib\external\libjpeg `
-DJPEG_LIBRARY=..\dlib\external\libjpeg `
-DPNG_PNG_INCLUDE_DIR=..\dlib\external\libpng `
-DPNG_LIBRARY_RELEASE=..\dlib\external\libpng `
-DZLIB_INCLUDE_DIR=..\dlib\external\zlib `
-DZLIB_LIBRARY_RELEASE=..\dlib\external\zlib `
-DCMAKE_INSTALL_PREFIX=install ..

cmake --build . --config Release --target INSTALL
cd ..

Dlib will be installed within dlib-19.6\build\install directory. We will use CMake to build Dlib examples but you can use Visual Studio too. This directory (dlib-19.6\build\install) contains include and library folders which you can specify in Visual Studio to build projects using Dlib.

Step 6: Update user environment variable – dlib_DIR

This environment variable is needed for CMake to find out where Dlib is installed. CMake looks for a file named dlibConfig.cmake within directory dlib_DIR to find Dlib’s include and library directories.

  1. Press Windows Super key, search for “environment variables”.
    Search System Environment Variables from Windows search menu

  2. Click Environment Variables in System Properties window.
    Edit Environment Variables

  3. Click New in “User Variables” (in upper half of window).
  4. Under variable name write dlib_DIR and under variable value write full path to directory dlib-19.6\build\install\lib\cmake\dlib
    On my machine path is: D:\programming\dlib-19.6\build\install\lib\cmake\dlib
    This directory contains file “dlibConfig.cmake”. This is used by CMake to configure dlib_LIBS and dlib_INCLUDE_DIRS variables to generate project files. Before assigning the value to variable dlib_DIR make sure that this path has file dlibConfig.cmake.
  5. Now click ok to save and close environment variables window.

Note: If you have an open Command Prompt/Power Shell window before these values were updated, you have to close and open a new Command Prompt/Power Shell window again.

Step 7: Build Dlib examples

We will use our CMakeLists.txt file instead of one which is shipped with Dlib.
Download modified CMakeLists.txt file and put it in dlib-19.6\examples directory and replace the default one with this one. Then follow the steps given below:

cd dlib-19.6/examples
mkdir build
cd build

cmake -G "Visual Studio 14 2015 Win64" ..
cmake --build . --config Release
cd ../..

Once build is complete, it will generate executables for all examples in examples\build\Release folder.

Step 8: Test Dlib’s C++ example

We will test Face Landmark Detection demo to check whether we have installed Dlib correctly.
Download trained model of facial landmarks from Dlib’s website. Extract this file (shape_predictor_68_face_landmarks.dat.bz2) to Dlib’s root directory (dlib-19.6).

cd examples\build
.\Release\face_landmark_detection_ex.exe ..\..\shape_predictor_68_face_landmarks.dat ..\faces\2008_001009.jpg

Step 9: Install Dlib’s Python module (Only Anaconda 3)

Compiling Python bindings for Dlib from source is non-trivial. You have to compile Boost.Python from scratch and configure some environment variables (such as BOOST_ROOT and BOOST_LIBRARYDIR) before you can compile Python module of Dlib. We are skipping that part for now. A complete tutorial on how to build Dlib Python bindings from source will be released in future.

To save time and efforts it is suggested to use Anaconda 3. You can install a compiled binary of dlib v19.4 from Anaconda. At the time this article was updated Dlib’s latest available version on Anaconda’s conda-forge repository is 19.4. So we will install v19.4 instead of 19.6

conda install -c conda-forge dlib=19.4

Step 10: Test Dlib’s Python example

cd dlib-19.6\python_examples
python face_landmark_detection.py ..\shape_predictor_68_face_landmarks.dat ..\examples\faces\


Github Cfuhfsgh Dlib Library Installation How To Install Dlib

Github Cfuhfsgh Dlib Library Installation How To Install Dlib After installing this update, Windows 10 22H2 will be updated to build 190455737 and Windows 10 21H2 will be build 190445737 Windows 10 users can also manually download and install the

Installing The Dlib Library For Windows By Rodrick Calvin Wamala

Installing The Dlib Library For Windows By Rodrick Calvin Wamala

Installing The Dlib Library For Windows By Rodrick Calvin Wamala

Installing The Dlib Library For Windows By Rodrick Calvin Wamala

Понравилась статья? Поделить с друзьями:
0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • Windows 2012 r2 rus eng
  • Установить word 2010 бесплатно для windows 10
  • Как включить отображение формата файла windows 11
  • Kb2999226 windows 7 x64 для чего
  • Установка первого контроллера домена windows server 2016