-
Notifications
You must be signed in to change notification settings - Fork 13.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows Installation Guide #175
Comments
You don't need to manually install dlib. I was able to install it with pip (through the Which leads me to my second point; your tutorial does not mention CMake at all. I have no idea what CMake actually does, so it may not be required, but if it does have something to do with simplifying the install process, you should add it to your tutorial. |
@TheDogeOfTheInternet yes you are right the |
Thanks @masoudr! I'll link it from the README. |
hello @masoudr, i want to know CMake install procedure. Thanks. |
@PBShortStop Installation of CMake in windows is very simple just grab the installation file (*.msi) from this link and install it. Remember to check the "Add CMake to system path" during the installation. Then you can simply use |
Dear all, |
@BachDoXuan you need to use the visual studio 2015 compiler(msvc-14.0), 14.1 is bugged. You also need at least 2GB RAM, because face_recognition.cpp takes a lot of memory during compilation(which could be the reason it takes so long). |
I use VS CE 2017, 8GB RAM laptop. I use Windows 10 Pro but the windows is not activated. I have no idea what problem I have. Can you help me to install dlib? |
@BachDoXuan I used MSVC-14 and haven't tested the 2017 version. Are you using the precompiled version of Boost or compiling it by yourself? |
@masoudr @neutrinobomber Thank you very much for your helps. The screen doesn't have any error log. It just got stuck when building dlib at face_recognition.cpp, I waited for more than hour every time I got there. But currently when I use command "pip install face_recognition" directly, then it succeeds. |
@BachDoXuan You are right, you can always use pip to install this package without any further work on windows. This tutorial is for the people who wanted to build |
This is a known problem. Visual Studio 2017 is buggy and has worse support
for C++11 than Visual Studio 2015. No one has been able to find a
workaround other than to use Visual Studio 2015.
|
Hey! I have a problem while following this tutorial. jpeg.lib(jdatadst.c.obj) : error LNK2019: unresolved external symbol _imp_ferror referenced in function term_destination [C:\Users\Loqpa\Downloads\dlib-master\dlib-master\tools\python\build\dlib.vcxproj] Any ideas how to fix it? I am up to trying everything you suggest:) |
@loqpa Hi, |
@masoudr Hello! |
@loqpa I used this method for the specified version of dependencies, so I am not sure if they work for other versions too. |
Does anyone have the link to download, Microsoft Visual Studio 2015 with C / C ++ Compiler |
@Klinsman21 google is your friend :) try this. |
@masoudr what |
@loqpa If you compile |
Can anybody help me ? libboost_python3-vc140-mt-s-1_65_1.lib(errors.obj) : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86' [D:\DEV\dlib-master\tools\python\build\dlib_.vcxproj] |
@cmlyldz You are trying to compile an |
@masoudr Thanks for answer. The problem was my python but there is no problem thanks to you. |
@hepingtao Please give me more information about the exact version of your tools like python version? |
@hepingtao be careful while downloading scipy, numpy you have to download them x86 like others(if you want to use x86). Also python, boost and also dlib must compile on x86 also. If you did everything in an x86 compiler (or x64) there will be no error. |
I have installed cmak and added to path but while installing dlib getting message to install cmak |
@008karan If your CMake is successfully added, you can use |
|
As the error indicates, you need to install CMake and add it to your system PATH. |
|
If you want to install the dlib library, you need to install c++ |
For anyone facing errors trying to install directly on windows, there is the option of using a WSL(Windows Subsystem for Linux), wich is a native VM implementation for windows. You can install normally the API like you would in a Linux machine, then you can acess it directly through Windows using VScode with the extension "Remote -WSL"(instuctions on how to do that are on the extension description itself). Here is an example on it working perfeclty using Flask like if i am running it locally on windows. |
environment: windows python3.8.8 |
Running setup.py install for dlib did not run successfully.
note: This error originates from a subprocess, and is likely not a problem with pip. × Encountered error while trying to install package. note: This is an issue with the package mentioned above, not pip. |
Hello good people! I was wondering if the encoding becomes properly trained if there is only 1 picture of each person or does there need to be at least more than 1 or something. Thats because when i have single image of different people the encoding after training , the recognition part gives a wrong detection. But whenever i have about 3 or more images of the same person being trained on the encodings, the recognition script gives the correct detection. Any input would be hugely appreciated |
Hello good people! I was wondering if the encoding becomes properly trained if there is only 1 picture of each person or does there need to be at least more than 1 or something. Thats because when i have single image of different people the encoding after training , the recognition part gives a wrong detection. But whenever i have about 3 or more images of the same person being trained on the encodings, the recognition script gives the correct detection. Any input would be hugely appreciated |
Clone dlib https://github.com/davisking/dlib.git |
The installation process worked perfectly without any issues for me. When I try pip list, face-recognition is there.
But when I try to import it in my project I get the error saying can some one please help me |
@MalshaDeZ I think your problem might be based on using the wrong environment, first you can double check your version with |
Hey @masoudr , thank you for getting back. Yes true that was the case. I am no able to import everything perfectly. But when run my code I get the error Following are my versions I would really appreciate any help on this.
|
Facing Same issue, was this solved |
|
dlib installing issue using vs code window 10/11 can you please guide ERROR: × Building wheel for dlib (pyproject.toml) did not run successfully.
note: This error originates from a subprocess, and is likely not a problem with pip. [notice] A new release of pip is available: 23.1.2 -> 23.2.1 |
I solved it in a clean, standalone Python environment using a prebuilt dlib whl: |
can you please give the link from where to download and how to setup |
@Akshitsingh-1 My comment here has the full instructions: The crucial part is that it worked only with Python 3.6 and not newer because I could not find precompiled dlib for newer Python versions.
|
|
@faizannazir - if you clone dlib git, won't it attempt to compile it during install, leading to the same problems (requiring the right compilation tools etc.)? It's simpler to just download a pre-built dlib. |
It will compile when you run given pip command with no error |
install dlib in windows is very easy. It is explained in the link below : |
Your instructions make no sense to me on this part going on 3-3. Open Developer Command Prompt for Visual Studio and go to the current directory of Boost extracted and try these commands to compile Boost: i cant go past this because i still dont understand this |
I can install dlib and face-recognition, but when running the sample project, the program reported an error and some files were missing. Where should I complete these files? (Note: My computer is Windows 10, Python version 3.9.7)
demo: import face_recognition
import cv2
import numpy as np
# This is a demo of running face recognition on live video from your webcam. It's a little more complicated than the
# other example, but it includes some basic performance tweaks to make things run a lot faster:
# 1. Process each video frame at 1/4 resolution (though still display it at full resolution)
# 2. Only detect faces in every other frame of video.
# PLEASE NOTE: This example requires OpenCV (the `cv2` library) to be installed only to read from your webcam.
# OpenCV is *not* required to use the face_recognition library. It's only required if you want to run this
# specific demo. If you have trouble installing it, try any of the other demos that don't require it instead.
# Get a reference to webcam #0 (the default one)
video_capture = cv2.VideoCapture(0)
# Load a sample picture and learn how to recognize it.
obama_image = face_recognition.load_image_file("obama.jpg")
obama_face_encoding = face_recognition.face_encodings(obama_image)[0]
# Load a second sample picture and learn how to recognize it.
# biden_image = face_recognition.load_image_file("biden.jpg")
# biden_face_encoding = face_recognition.face_encodings(biden_image)[0]
# Create arrays of known face encodings and their names
known_face_encodings = [
obama_face_encoding,
# biden_face_encoding
]
known_face_names = [
"Barack Obama",
# "Joe Biden"
]
# Initialize some variables
face_locations = []
face_encodings = []
face_names = []
process_this_frame = True
while True:
# Grab a single frame of video
ret, frame = video_capture.read()
# Only process every other frame of video to save time
if process_this_frame:
# Resize frame of video to 1/4 size for faster face recognition processing
small_frame = cv2.resize(frame, (0, 0), fx=0.25, fy=0.25)
# Convert the image from BGR color (which OpenCV uses) to RGB color (which face_recognition uses)
rgb_small_frame = small_frame[:, :, ::-1]
# Find all the faces and face encodings in the current frame of video
face_locations = face_recognition.face_locations(rgb_small_frame)
face_encodings = face_recognition.face_encodings(rgb_small_frame, face_locations)
face_names = []
for face_encoding in face_encodings:
# See if the face is a match for the known face(s)
matches = face_recognition.compare_faces(known_face_encodings, face_encoding)
name = "Unknown"
# # If a match was found in known_face_encodings, just use the first one.
# if True in matches:
# first_match_index = matches.index(True)
# name = known_face_names[first_match_index]
# Or instead, use the known face with the smallest distance to the new face
face_distances = face_recognition.face_distance(known_face_encodings, face_encoding)
best_match_index = np.argmin(face_distances)
if matches[best_match_index]:
name = known_face_names[best_match_index]
face_names.append(name)
process_this_frame = not process_this_frame
# Display the results
for (top, right, bottom, left), name in zip(face_locations, face_names):
# Scale back up face locations since the frame we detected in was scaled to 1/4 size
top *= 4
right *= 4
bottom *= 4
left *= 4
# Draw a box around the face
cv2.rectangle(frame, (left, top), (right, bottom), (0, 0, 255), 2)
# Draw a label with a name below the face
cv2.rectangle(frame, (left, bottom - 35), (right, bottom), (0, 0, 255), cv2.FILLED)
font = cv2.FONT_HERSHEY_DUPLEX
cv2.putText(frame, name, (left + 6, bottom - 6), font, 1.0, (255, 255, 255), 1)
# Display the resulting image
cv2.imshow('Video', frame)
# Hit 'q' on the keyboard to quit!
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# Release handle to the webcam
video_capture.release()
cv2.destroyAllWindows() |
In step 6, you can use set flag instead of yes like below. because --yes options are on by default.
|
Hi,
I've successfully installed and tested this tool on my Windows 10 machine, and I'm writing a simple procedure to install it. It may be useful for some people to try to use this tool on a Windows machine.
IMPORTANT: Actually, this project has been done for Linux systems, especially
dlib
. In my tests, the performance of this tool in Windows 10 was about a quarter compared to Ubuntu, built with the same specs. But I haven't seen any difference between these two in other subjects.Read First:
The new version of
dlib
doesn't needBoost
anymore, so you can skip it. Remember that you still need to meet the following requirements.Requirments:
(I've used this tutorial with these tools installed on Windows 10, but the newer versions may work too.)
dlib
)Python3
(I usedPython3.5 x64
but the other versions may work too)CMake
for windows and add it to your system environment variables.dlib
)Boost
library version 1.63 or newer. Also, you can use precompiled binaries for specific MSVC you have, but I don't suggest. (I've included the compiling procedure ofBoost
in this tutorial)Installation:
Easy installation:
Just install
dlib
andface_recognition
(not always on the newest version):pip install dlib
and thenpip install face_recognition
.Manual installation:
scipy
andnumpy+mkl
(must be mkl version) packages from this link (all credits goes to Christoph Gohlke). Remember to grab the correct version based on your current Python version.Boost
library source code or binary release for your current MSVC from this link.Boost
by yourself:3-1. Extract the
Boost
source files intoC:\local\boost_1_XX_X
(X means the current version ofBoost
you have)3-2. Create a system variable with these parameters:
Name:
VS140COMNTOOLS
Value:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\
(or any path where you have installed MSVC)3-3. Open Developer Command Prompt for Visual Studio and go to the current directory of
Boost
extracted and try these commands to compileBoost
:bootstrap
b2 -a --with-python address-model=64 toolset=msvc runtime-link=static
3-4. If you successfully compile
Boost
, it should create compiled files instage
directory.Boost
skip this step) If you already download the binary release, extract the contents toC:\local\boost_1_XX_X
dlib
from this repo and extract it.dlib
directory and open cmd and follow these commands to builddlib
: (remember to replace XX with the current version ofBoost
you have)set BOOST_ROOT=C:\local\boost_X_XX_X
set BOOST_LIBRARYDIR=C:\local\boost_X_XX_X\stage\lib
python setup.py install --yes USE_AVX_INSTRUCTIONS
orpython setup.py install --yes USE_AVX_INSTRUCTIONS --yes DLIB_USE_CUDA
import dlib
without any problem in your python script.dlib
withpip show dlib
.face_recognition
withpip install face_recognition
.Finally, I need to say thanks to @ageitgey and @davisking for their awesome work.
The text was updated successfully, but these errors were encountered: