Article From:

Because of a certain force majeure (it is it!) I wrote this blog, the main purpose is to record.


face_recognitionKnown as the simplest face recognition library in the world, it can be invoked using Python and command line. The library uses Dlib’s top-level deep learning face recognition technology to build Labeled Faces in the Wild in outdoor face detection database.The accuracy rate on benchmark) is up to 99.38%. It also provides a simple face_recognition command line tool that allows you to recognize faces from the command line to the image folder.

In a nutshell, the following are the main functions:

  • Find faces in pictures
  • Find and manipulate facial features in pictures
  • Identify faces in pictures

Here is the GitHub home page and the document:

  • GitHub-face_recognition
  • readthedocs

environment configuration

readmeIt was mentioned that:

  • Python 3.3+ or Python 2.7
  • macOS or Linux (Windows not officially supported, but might work)
  • dlib already installed with Python bindings

Here is the three point, meaning that your Dlib library will install the Python module.

  1. Python&pipEnvironmental Science:
    MacBring Python2.7.10, no matter what, install Python3 can be used.brew install python,Default installation of Python3 (with PIP3)
    If you use Python2, it will not bring pip, because it needs to be installed later, so you have to install PIP2.sudo easy_install pipInstall, remember to use sudo permissions here.

    Searching for pip
    Best match: pip 10.0.1

    pipThe installation will automatically match the version that is suitable for your system. After installation, you can check the PIP information:

    localhost:~ mac$ pip --version
    pip 10.0.1 from /Library/Python/2.7/site-packages/pip-10.0.1-py2.7.egg/pip (python 2.7)
  2. Install Dlib
    I installed it in gitclone:
    git clone
    After downloading, follow the steps to install (no cmake Baidu installation):

    cd dlib/examples
    mkdir build
    cd build
    cmake .. 
    cmake --build . --config Release

    The default C++ library is installed here. We also need to install the Python module:

    cd dlib
    sudo python install
    import dlib

    Be sure to go into the Python import:

    After the completion, restart the terminal.

  3. Install face_recognition
    Install with PIP (install this module from pypi using PIP3 (or PIP2 for for 2))
    pip2 install face_recognition
    I defaults that the environment is Python2, and I use PIP2.
    And then it’s waiting, the speed is slow, and…

    ???There are two ways to solve this problem:
  • Lengthening time:pip --default-timeout=100 install -U pip
  • Modify source (for domestic source): temporary source, using parameter -i:pip2 install face_recognition -i
    First used the first method, dozens of K per second, or overtime, so we suggest that you directly use second ways to specify temporary source, Tsinghua’s super fast!

    Don’t be too happy to see that the red part is wrong.Permission Denied(Denied access) because there is no authority when installing pillow, so I recommend using before installation.sudoOr add the back to the back--user(It means that it is only the installation of the user)

    noticeSuccessfully installed Click-6.7 face-recognition-1.2.2 face-recognition-models-0.3.0That’s right.
    checkFor a second, use the command line:


We enter commands in the command line:
face_recognition ./known_people/ ./unknown_people/
Wait a few seconds.


Later I tested several groups and found that the API recognition of Asian race is not very accurate.


  • face_recognition
  • mac OSXInstall Dlib (Python) below
  • GithubThe most interesting 10 machines in the near future learn open source projects
  • Change the PIP source to the domestic mirror
  • pip install Error – ReadTimeoutError
  • macPrompt OSError: [Errno 13] Permission denied:’/Library/Python/2.7/site-packages/pip-8.0.2-py2. when updating pip

Leave a Reply

Your email address will not be published. Required fields are marked *