Sie sind auf Seite 1von 32

Face Detection using Principal Component Analysis

Abhishek Roy 2K3/EC/603

Anuj Jain 2K3/EC/613

Arpit Gupta 2K3/EC/614

Guide: Ms S Indu, ECE Dept, DCE

Objective
To do face detection using Principal Component Analysis (PCA).

Why face detection ?


Various potential applications, such as Applications in biometrics Video surveillance Human-computer interaction. Image database management systems

Principal Components Analysis


It is a way of identifying patterns in data, and expressing the data in such a way as to highlight their similarities and differences. Eigenvector approach Data Compression

Some important terms Standard Deviation -- a measure of how spread out the data is.

Variance -- is the square of standard deviation. These two measures are purely 1-dimensional.

Covariance -- is always measured between 2 dimensions.

Covariance is the measure of how much two random variables vary together. If the value is +ve then both dimensions increase together & if ve, they are inversely proportional.

Covariance Matrix

where S is the covariance matrix, sjk is the covariance of variables Xj and Xk when j k and the diagonal element sjjis the variance of variable Xj when j = k.

Method 1. Obtain the data in the form of a matrix. 2. Obtain the covariance matrix for the data. 3. Calculate the eigenvectors and eigenvalues of the covariance matrix. The eigenvector with the highest eigenvalue is the principle component of the data set. 4. Select the eigenvectors with the highest eigenvalues and form a matrix which is smaller in size compared to the data matrix.

PCA projects the data along the directions where the data varies the most.
Directions are determined by the eigenvectors of the covariance matrix corresponding to the largest eigenvalues

EIGENFACES

Set of eigenvectors Develpoed by Matthew Turk and Alex Pentland Eigenfaces can be extracted out of the image data by means of the mathematical tool called Principal Component Analysis (PCA)

Face detection based on eigenface approach

Acquire a set of training images of same size.

Calculate the covariance matrix for the training set.

Calculate the eigenfaces from the covariance matrix, keeping only the best M images with the highest eigenvalues. These M images define the face space.

Given an image, calculate a set of weights of the M eigenfaces by projecting it onto each of the eigenfaces

Determine if the image is a face at all by checking to see if the image is sufficiently close to the face space

Image Representation
A square, N by N image can be expressed as an N2 dimensional vector.

Say we have 20 images. Each image is N pixels high by N pixels wide. Write each image as an image vector and put all the images together in one big image-matrix like this:

The Space of Faces


An image is a point in a high dimensional space

Pixel 2 gray value

x is an image of N pixels and

x
Pixel 1 gray value

a point in N-dimensional space

Training Set

Experiment
JAFFE image database 20 images(M) 256 x 256 (N x N) Each image converted into a column vector of N2 x 1 Column vectors stacked together to get a matrix (N2 x M) Covariance matrix needed (N2 x N2) over 4 billion entries Calculate eigenvectors of the covariance matrix

Problem: Size of Covariance Matrix C


Each data point is N2 -dimensional (N2 pixels)
The size of covariance matrix A is N2 x N2 The number of eigenfaces is N2 Example: For N2 = 256 x 256 pixels, Size of C will be 65536 x 65536 ! Number of eigenvectors will be 65536 ! Typically, only a few eigenvectors suffice. So, this method is very inefficient!

Efficient Computation of Eigenvectors


If B is N2xM and M<<N2 then C=BBT is N2xN2 >> MxM
M number of images, N2 number of pixels

use BTB instead, eigenvector of BTB is easily converted to that of BBT

(BTB) y = e y => B(BTB) y = e (By) => (BBT)(By) = e (By) => By is the eigenvector of BBT

Eigenfaces
PCA extracts the Eigenfaces of the set of images
Gives a set of vectors v1,v2,v3 Each vector represents a dimension in the face space What do they look like?

Projecting an image onto face space


The eigenfaces v1vk span the face space.
A face is projected onto eigen coordinates by
)

a9v9

a10v10

Projections

Procedure
1. Process the image database (training set of images)
Run PCAcompute eigenfaces

2. Given a new image (to be detected) x, calculate K coefficients

3. Detect if x is a face

Detection Result

Result
Image name Images part of the training set KA.HA1.29 MK.NE3.115 3.0430e+012 1.4271e+012 Distance

Images not part of training set but belonging to people in the set YM.HA2.53 KA.NE2.27 4.4622e+012 1.3121e+012

Images with no relation to the training set Containing a face lena Not containing a face nens wheel grey 2356R CT_scan Lone 7.9097e+012 8.8347e+012 3.4745e+012 8.9020e+012 5.9903e+012 3.8256e+012 2.6338e+012

Threshold value
Threshold value = 3.4745e+12 (corresponding to image grey) fails to detect a face in the image -- YM.HA2.53. If the threshold value is increased to the distance corresponding to the image -- YM.HA2.53, then 100% detection takes place but accuracy goes down as the program will detect faces in images with no human face in them. Also, the image nens consists of a number of faces, but they are not detected.

Implementation
MATLAB
Imread Reshape Double Clear Eig Zeros Pdist Uint8

Eigenfaces summary in words


Eigenfaces are the eigenvectors of the covariance matrix obtained from the training set. Eigenfaces are the standardized face ingredients derived from the statistical analysis of many pictures of human faces A human face may be considered to be a combination of these standardized faces

Conclusion
Project images onto a low-dimensional linear subspace face space, defined by eigenfaces.

The distance between an image and its projection in face space is compared to a threshold value determined experimentally.

This approach was tested on a number of images giving good detection results.

Advantage
Ease of implementation Simplicity of the maths behind the concept. No knowledge of geometry or specific feature of the face is required.

Limitation
Applicable only to front views

Input images should be of the same type(size, color, etc) as the images in the trainig set

Refrences 1.Eigenfaces for recognition, M. Turk and A. Pentland 2. Face recognition using eigenfaces, M. Turk and A. Pentland 3. Stellar Spectral Classification using Principal Component Analysis and artificial neural networks, Harinder P Singh, Ravi K Gulati and Ranjan Gupta 4. http://en.wikipedia.org/wiki/Eigenface 5. http://en.wikipedia.org/wiki/Principal_Component_Analysis 6. Advanced Engineering Mathematics by Erwin Kreyszig 7. JAFFE image database "Coding Facial Expressions with Gabor Wavelets, Michael J. Lyons, Shigeru Akamatsu, Miyuki Kamachi, Jiro Gyoba

Das könnte Ihnen auch gefallen