Face Recognition Using dlib’s State Of Art ‘face_recognition’
- General
Face Recognition Using dlib’s State Of Art ‘face_recognition’
Face Recognition
Recognize and manipulate faces from Python or from the command line with the world’s simplest face recognition library. Built using dlib’s state-of-the-art face recognition built with deep learning. The model has an accuracy of 99.38% on the Labeled Faces in the Wild benchmark.
This also provides a simple face_recognition command-line tool that lets you do face recognition on a folder of images from the command line!
Installing Dlib
1. Install os libraries
sudo apt-get install build-essential cmake
pkg-config
sudo apt-get install libx11-dev
libatlas-base-dev
sudo apt-get install libgtk-3-dev
libboost-python-dev
2.install python libraries
sudo apt-get install python-dev
python-pip python3-dev python3-pip
sudo -H pip3 install -U pip numpy
We will use Virtual Environment to install Python libraries. It is generally a good practice in order to separate your project environment and global environment
sudo pip3 install virtualenv virtualenvwrapper
#create a virtual environment
mkvirtualenv facecourse-py3 -p python3
workon facecourse-py3
# now install python libraries within this virtual environment
pip install numpy scipy matplotlib scikit-image scikit-learn ipython
Dlib installation without GPU support
$ workon # optional
$ pip install dlib
or you can compile the following code
$ workon <your env name here> # optional
$ git clone https://github.com/davisking/dlib.git
$ cd dlib
$ mkdir build
$ cd build
$ cmake .. -DUSE_AVX_INSTRUCTIONS=1
$ cmake --build .
$ cd ..
$ python setup.py install --yes USE_AVX_INSTRUCTIONS
Installing dlib with GPU support (optional)
If you do have a CUDA compatible GPU you can install dlib with GPU support, making facial recognition faster and more efficient.
For this, I recommend installing
$ workon <your env name here> # optional
$ 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 --yes USE_AVX_INSTRUCTIONS --yes DLIB_USE_CUDA
Install the face_recognition package
$ workon <your env name here> # optional
$ pip install face_recognition
Install imutils( You’ll also need my package of convenience functions, imutils. You may install it in your Python virtual environment via pip)
$ workon <your env name here> # optional
$ pip install imutils
Now we can see the project setup, hit command tree
in the directory containing the project
In the dataset we create folders for every person and to create encodings we put images of those people to prepare encodings for.
We prepare encodings by running encode_faces.py
And encodings are saved in encodings.pickle file
Results demo:-
Related content
Toll mangement and command centre with TMCC
We’re passionately committed to helping our clients and their customers thrive, working side by side to drive customer value and results..
A Smarter Health Safety Solution
We’re passionately committed to helping our clients and their customers thrive, working side by side to drive customer value and results..
Building fastest loan portal in India
We’re passionately committed to helping our clients and their customers thrive, working side by side to drive customer value and results..
Toll mangement and command centre with TMCC
We’re passionately committed to helping our clients and their customers thrive, working side by side to drive customer value and results...
Toll mangement and command centre with TMCC
We’re passionately committed to helping our clients and their customers thrive, working side by side to drive customer value and results..
Entreprise IT Transformation and Automation
We understand user and market, create product strategy and design experience for customers and employees to make breakthrough digital products and services