face recognition method of opencv andrew stodghill

34
Face Recognition Method of OpenCV ANDREW STODGHILL

Upload: justin-lambert

Post on 17-Dec-2015

224 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Face Recognition Method of OpenCV ANDREW STODGHILL

Face Recognition Method of OpenCVANDREW STODGHILL

Page 2: Face Recognition Method of OpenCV ANDREW STODGHILL

Overview

Introduction

Background

Theory

Experiment

Results

Conclusion

Page 3: Face Recognition Method of OpenCV ANDREW STODGHILL

Introduction

Page 4: Face Recognition Method of OpenCV ANDREW STODGHILL

Idea

Facial recognition for a Security Robot

Addition to another project

Gain a better understanding of the subject

Derived from work last semester

Page 5: Face Recognition Method of OpenCV ANDREW STODGHILL

Focus

Basic understand of OpenCV face recognition software and algorithms

Methods and Theory behind the EigenFace method for facial recognition

Implementation using Python in a Linux-based environment

Runs on a Raspberry Pi

Page 6: Face Recognition Method of OpenCV ANDREW STODGHILL

Goal

One half research General facial recognition methods

EigenFaces

OpenCV’s facial recognition

One half implementation Create a system capable of facial recognition

Real-time

Able to run on a Raspberry Pi

Page 7: Face Recognition Method of OpenCV ANDREW STODGHILL

Background

Page 8: Face Recognition Method of OpenCV ANDREW STODGHILL

Different Facial Recognition Methods

Geometric

Eigenfaces

Fisherfaces

Local Binary Patterns

Active Appearance

3D Shape Models

Page 9: Face Recognition Method of OpenCV ANDREW STODGHILL

Geometric

First method of facial recognition

Done by hand at first Automation came later

Find the locations of key parts of the face And the distances between them

Good initial method, but had flaws Unable to handle multiple views

Required good initial guess

Page 10: Face Recognition Method of OpenCV ANDREW STODGHILL

Eigenfaces

Information theory approach

Codes and then decodes face images to gain recognition

Uses principal component analysis (PCA) to find the most important bits

Page 11: Face Recognition Method of OpenCV ANDREW STODGHILL

Fisherfaces

Same approach as Eigenface

Instead of PCA, uses linear discriminant analysis (LDA)

Better handles intrapersonal variability within images such as lighting

Page 12: Face Recognition Method of OpenCV ANDREW STODGHILL

Local Binary Patterns

Describes local features of an object

Comparison of each pixel to its neighbors

Histogram of image contains information about the destruction of the local micro patterns

Page 13: Face Recognition Method of OpenCV ANDREW STODGHILL

Theory

Page 14: Face Recognition Method of OpenCV ANDREW STODGHILL

Basic Idea

Let face image be a two-dimensional by array of (8-bit) intensity values

Can consider image an vector of dimensions

Image of 256 by 256 becomes a 65,536 vector of dimension Or a point in 65,536-dimensional space

Page 15: Face Recognition Method of OpenCV ANDREW STODGHILL

Basic Idea

Images of faces will not differ too much

This allows a much smaller dimensional subspace to be used to classify them

PCA analysis finds the vectors that best define the distribution of images

These vectors are then long

Describe an by image

Linear combination of the original face images

Page 16: Face Recognition Method of OpenCV ANDREW STODGHILL

Basic Idea

These vectors are called eigenfaces They are the eigenvectors of the covariance matrix

Resemble faces

Page 17: Face Recognition Method of OpenCV ANDREW STODGHILL

Method

Acquire initial training set of face images

Calculate eigenfaces

Keep only eigenfaces that correspond to the highest eigenvalues These images now define the face space

Calculate corresponding distribution in -dimensional weight space for each known individual

Page 18: Face Recognition Method of OpenCV ANDREW STODGHILL

Method

Calculate weights for new image by projecting the input image onto each of the eigenfaces

Determine if face is known Within some tolerance, close to face space

If within face space, classify weights as either known or unknown

(Optional) Update eigenfaces and weights

(Optional) If same face repeats, input into known faces

Page 19: Face Recognition Method of OpenCV ANDREW STODGHILL

Classifying

Four possibilities for an input image

Near face space, near face class Known face

Near face space, not near face class Unknown face

Not near face space, near face class Not a face, but may look like one (false positive)

Not near face space, not near face class Not a face

Page 20: Face Recognition Method of OpenCV ANDREW STODGHILL

OpenCV and Theory

Beauty about OpenCV is a lot of this process is completely automated

Need: Training images

Specify type of training

Number of eigenfaces

Threshold

Input Image

Page 21: Face Recognition Method of OpenCV ANDREW STODGHILL

Experiment

Page 22: Face Recognition Method of OpenCV ANDREW STODGHILL

Set-up

OpenCV running on a Raspberry Pi

Linux-based environment

Raspberry Pi Camera

Page 23: Face Recognition Method of OpenCV ANDREW STODGHILL

Training

Database of negatives

AT&T Laboratories Database of faces developed in the 90s

Page 24: Face Recognition Method of OpenCV ANDREW STODGHILL

Training

Captured Positives

Used the camera to capture images

Images were then cropped and resized

Page 25: Face Recognition Method of OpenCV ANDREW STODGHILL

Training

Model was trained using positive and negative images

Creates training file that holds the -dimensional face space

Now have a base to recognize from

model = cv2.createEigenFaceRecognizer()

model.train(np.asarray(faces),np.asarray(labels))

Page 26: Face Recognition Method of OpenCV ANDREW STODGHILL

Recognition

Steps to recognizing face Capture image

Detect face

Crop and resize around face

Project across all eigenvectors

Find face class that minimizes Euclidian distance

Return label from face class, and Euclidian distance

Euclidian distance also called Confidence level

model = cv2.createEigenFaceRecognizer()model.load(config.TRAINING_FILE)label, confidence = model.predict(image)

Page 27: Face Recognition Method of OpenCV ANDREW STODGHILL

Test

Created four different Test First data set uses 24 positive training images

Almost no pose and lighting variation

Second data set uses 12 positive training images

Good pose variation, little lighting variation

Third data set uses 25 positive training images

Good pose and lighting variation

Fourth data set uses second and third data set but with Fisherface method

Page 28: Face Recognition Method of OpenCV ANDREW STODGHILL

Results

Page 29: Face Recognition Method of OpenCV ANDREW STODGHILL

Results

Results from Data sets 1-3, each one from 20 input images

Confidence represents distance from known face class

Data Set Mean Confidence

Max Confidence

Min Confidence

1 3462 3948 3040

2 2127 2568 1835

3 1709 2196 1217

Page 30: Face Recognition Method of OpenCV ANDREW STODGHILL

Results

Results from eigenface vs. fisherface comparison

Algorithm Data Set # Training Images

Mean Confidence

Max Confidence

Min Confidence

Eigen 2 12 2127 2568 1835

Fisher 2 12 2029 2538 1468

Eigen 3 25 1709 2196 1217

Fisher 3 25 2017 2748 1530

Page 31: Face Recognition Method of OpenCV ANDREW STODGHILL

Conclusion

Page 32: Face Recognition Method of OpenCV ANDREW STODGHILL

Conclusion

Theory behind eigenfaces Face space

Training

Simple implementation of OpenCV’s eigenface recognizer

Compared different training models Number of training images

Pose and lighting variations

Compared eigenfaces and fisherfaces

Page 33: Face Recognition Method of OpenCV ANDREW STODGHILL

Conclusion

Future work Further testing of different training models

Implement updating facial recognition

Page 34: Face Recognition Method of OpenCV ANDREW STODGHILL

Questions?