From the course: Deep Learning: Face Recognition

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Coding face detection

Coding face detection - Python Tutorial

From the course: Deep Learning: Face Recognition

Start my 1-month free trial

Coding face detection

- [Instructor] Let's write the code to detect faces in an image. Open up face_detection.py. In these example files, I've already added in some of the basic structure. We're gonna focus on filling in the section specific to face detection. But you can read through each example line by line if you are newer to Python. In this file, we'll be using a pre-trained HOG face detector to detect all the faces that appear in an image. Because most human faces have roughly the same structure, the pre-trained face detection model will work well for almost any image. There's no need to train a new one from scratch. First, notice on line one, I've already imported the PIL library's image class, and then the image draw class. PIL is the Python Image Library. It lets us easily display an image on the screen, and draw lines on top of the image. We'll use it to display the results of our face detection code. Next, on line three, let's import the face recognition library. Import face_recognition. This is…

Contents