Member-only story
Image Face Recognition in Python
How to recognise faces on the image using Python and face_recognition library
In my last article, I wrote about Introduction to Computer Vision with MNIST. In this article, we will approach a different but also quite common and interesting Computer Vision problem which is face recognition.
We will use face_recognition Python library for face recognition and Python Imaging Library (PIL) for image manipulation. We will not only recognise known faces on the tes image but we will also mark and label faces on the image with PIL.
Introduction
Face recognition is popular and useful computer vision challenge. Face Recognition is a very useful tool in many areas. For example it can be used in security and law enforcement to find missing people, identify criminals or support investigations. It can be also used in healthcare to identify certain diseases. Or it can be also used in marketing and retail to personalise user experience. But these are just a few examples and the list of use cases for face recognition is long.
What will you learn?
In this project you will learn how to display images in Jupyter Notebook, find and count faces in the image and find known and unknown faces on the image and label their faces.
Let’s get started.
Problem definition
We have an image with a group of three people (in the project folder “images/groups”). We only know one person from the image (we have a photo of this person in the folder “images/known”). Our task is to load the group image into Jupyter Notebook, count the number of faces in the image, find our known person and create rectangles on the image around all faces and if we know the face put the name of the person next to the rectangle and if we don’t know display “unknown”.

Step by step solution
If you don’t have your computer set up for data science read my article How to set up your computer for Data Science.