讲解Python Jupyter notebook 人工智能 face recognition system 、辅导python 设计

- 首页 >> Python编程


Project Tutorial - Week 1

For the first week, we will learn the overview of a face recognition system, setup the developing

environment and create the face photo dataset needed for the face recognition system.

1. Face Recognition System Overview

The following overview shows the workflow for a single input image.

1.1. Detect faces with a pre-trained models, commonly used features include HOG,

SIFT and Haar-like features.

1.2. Transform the face for the neural network. Transform the face by rotating or

resizing it into a near standard form, in order to enhance the performance of the

neural network.

1.3. Use a deep neural network to represent the face on a 128-dimensional unit

hypersphere. The embedding is a generic representation for anybody's face.

Unlike other face representations, this embedding has the nice property that a

larger distance between two face embeddings means that the faces are likely not

of the same person. This property makes clustering, similarity detection, and

classification tasks easier than other face recognition techniques where the

Euclidean distance between features is not meaningful.

1.4. Apply different clustering or classification techniques to the features to complete

the recognition task.

Fig1. Face Recognition System Overview

2. Environment setup

The environment requirements are

● Python 2.7

● Jupyter notebook or other python IDE

● Python packages: numpy, matplotlib, cv2, sklearn (optional: skimage, dlib) Use

the testing code (check_packages.py) to check if all packages are installed.

● OS: Ubuntu/Mac is preferable

● At least one group member should have access to a webcam

For starters, installing anaconda would be the easiest way to get started. Please check

the conda documentation for installation guide

(https://conda.io/docs/user-guide/install/index.html).

3. Create Photo Dataset

To create the dataset, there are two basic steps: collecting photos and labeling the

faces.

3.1. Collect photos

● Collect at least 30 photos for the 5 classification people each, 20 training photos

and 10 for testing

● Photos should be complex, meaning the face should be facing different

directions.

Fig2. Complex Photo Example

● Photos should have rich background

● Photos can contain multiple people

● Best in jpeg format

3.2. Label the photos with bounding boxes (example)

A bounding box is an imaginary box around an object. For our project the bounding box

locates the faces in the photo. For example,

Fig 3. Bounding Box

Labeling the photos will help us train and evaluate our system in the future, as we will

compare the bounding boxes detected by our system and the bounding box we labeled.

The specific steps for labeling are

● Create 5 text files corresponding to the 5 people

● In each text file, record the photos name and bounding box location of the person

● The bounding box can be denoted as:

○ [x y width height]: where x and y are the x- and y-coordinates of the

upper-left corner of the rectangle, and width and height are the width and

height of the rectangle. In Fig. 3, the bounding box for the woman would

be denoted as “Woman 86 124 90 91”.

○ [x1 y1 x2 y2]: where x1 and y1 are the x- and y-coordinates of the

upper-left corner of the rectangle, and x2 and y2 are the x- and

y-coordinates of the bottom-right corner of the rectangle. In Fig. 3, the

bounding box for the woman would be denoted as “Woman 86 124 175

216”.

● It would be best if the bounding box aspect ratio as 1:1. This would make the

training the face detector easier for next week.

Homework Submission:

Save the photo dataset and labels in two separate folders and upload the folders into the google

folder

Additional reading materials

[1] How to Build a Face Recognition System:

https://medium.com/@ageitgey/machine-learning-is-fun-part-4-modern-face-recognition-with-de

ep-learning-c3cffc121d78


站长地图