There are many different face recognition libraries, but face_recognition is quite accurate & Easy to use. This article introduces how to install and use the face_recognition lib on Windows. The name of this lib does not have a brand name that is named with a generic keyword, so I will abbreviate it as FR.
This article only focuses on using the lib, but the build lib will be written in another post.
1. Overview
This is an open source project written in Python, using Dlib for facial recognition. However, currently installing with the command on the lib homepage is faulty, so I will provide another way to install it.
The problem is that dlib and the latest FR version are not compatible with each other. Therefore, it is necessary to specify the appropriate version to install.
2. Settings
This article uses Python 3.6.5 amd64 to test (Windows x86-64 executable installer).
You copy the content below and save it as a requirement.txt file
cmake
Pillow==5.2.0
https://pypi.python.org/packages/da/06/bd3e241c4eb0a662914b3b4875fc52dd176a9db0d4a2c915ac2ad8800e9e/dlib-19.7.0-cp_amd64m-whl #md5=b7330a5b2d46420343fbed5df69e6a3f
face_recognition==1.2.3
numpy==1.17.2
Then type the command below to install the packages specified in the requirements.txt filepip3 install -r requirements.txt
Waiting for the packages to be installed.
3. Test the source code
You can download the example files from the github repo for testing: https://github.com /ageitgey/face_recognition/tree/master/examples
In it, there are easy-to-understand example files available:
– face_distance.py find the difference between 2 faces, the smaller the number, the more similar
– find_facial_features_in_picture.py find facial features
– recognize_faces_in_pictures.py load Obama and Biden images, then take another photo of Mr. Obama to compare
….
4. Download the source code
Github: https://github.com/ageitgey/face_recognition
Home: https://pypi.org/project/face_recognition/
Source: https://thigiacmaytinh.com/