Personal Blog
Programming

Face Recognition on Python

A few weeks ago, me & my brother were talking about face recognition on scanned family photos.
I got curious to find out how to implement a face recognition on Python.

1. Install Anaconda for Python Package Manager
It has a shell for downloading packages automatically.

2. Download & Install CMake
For compiling DLib on Visual Studio 2015

3. Install Visula Studio 2015 (Version is important)

4. Download DLib Package and Extract

5. Open CMake and configure like below:

6. Download & Install Face_Recognition Package

Using Anaconda Shell:

conda install -c conda-forge face_recognition

7. Refer to https://pypi.org/project/face-recognition/

Note: A basic about face recognition:
First: Introduce person who you want to detect
Second: After Face Recohgnition Engine learnt about that face, Input Unknown (Query) Image
Third: Get output. Engine will let you know if it could detect the specific person or not

This algorithm is about “Traning” (Step One) and “Test” (Step Two and Three)

import face_recognition
”’Load Train & Test Images”’
known_image = face_recognition.load_image_file ("biden.jpg")
unknown_image = face_recognition.load_image_file ("unknown.jpg")

”’Step One (Train)”’
biden_encoding = face_recognition.face_encodings (known_image)[0]

”’Step Two (Test)”’
unknown_encoding = face_recognition.face_encodings (unknown_image)[0]

”’Step Three (Get Result)”’
results = face_recognition.compare_faces ([biden_encoding], unknown_encoding

Leave a Reply

Your email address will not be published.

Back to top