PCA Based Face Recognition System

34
PCA Based Face Recognition System MD. ATIQUR RAHMAN

Transcript of PCA Based Face Recognition System

PCA Based Face

Recognition SystemMD. ATIQUR RAHMAN

Face Recognition using PCA Algorithm

PCA-

Principal Component Analysis

Goal-

Reduce the dimensionality of the data by retaining as much as variation

possible in our original data set.

The best low-dimensional space can be determined by best principal-

components.

Eigenface Approach

Pioneered by Kirby and Sirivich in 1988

There are two steps of Eigenface Approach

Initialization Operations in Face Recognition

Recognizing New Face Images

Steps

Initialization Operations in Face Recognition

Prepare the Training Set to Face Vector

Normalize the Face Vectors

Calculate the Eigen Vectors

Reduce Dimensionality

Back to original dimensionality

Represent Each Face Image a Linear Combination of all K Eigenvectors

Recognizing An Unknown Face

Prepare the Training

Set to Face Vector

………..

112 Γ— 92

10304 Γ— 1πœžπ’Š

Face vector space

Images converted to vector

Each Image size

column vector

𝑀= 16 images in the training set Convert each of face images in

Training set to face vectors

Normalize the Face

Vectors

Average face vector/Mean image (𝜳)

𝑀= 16 images in the training set

……….. 𝜳

Converted

Face vector space

Mean Image 𝜳

πœžπ’Š

Calculate Average face vector

Save it into face vector space

Subtract the Mean from each Face Vector

………..

Π€π’Š

𝜳

Converted

Face vector space

𝑀= 16 images in the training set

βˆ’ =

𝜞𝟏 𝚿 Ѐ𝟏

Normalized Face vector

Result of Normalization

Figure: Normalized Data set

Calculate the Eigen

Vectors

Calculate the Covariance Matrix (π‘ͺ)

C = 𝑛=116 Ѐ𝑛Ѐ𝑛

𝑇

= 𝐴𝐴𝑇

= {(𝑁2×𝑀). (𝑀 Γ— 𝑁2)}

= 𝑁2Γ— 𝑁2

= (10304 Γ— 10304)

Where 𝐴 = {Π€1, Π€2, Π€3, ……… ., Π€16}

[𝐀 = 𝐍𝟐 Γ—πŒ]……….. 𝜳

Π€π’Š

Face vector space

Converted

𝑀= 16 images in the training set

Converted

C = 10304 Γ— 10304

10304 eigenvectors

………

Each 10304Γ—1 dimensional

……….. 𝜳

Π€π’Š

Face vector space

π’–π’Š

Converted

𝑀= 16 images in the training set

In π‘ͺ, π‘΅πŸ is creating πŸπŸŽπŸ‘πŸŽπŸ’ eigenvectors

Each of eigenvector size is πŸπŸŽπŸ‘πŸŽπŸ’ Γ— 𝟏 dimensional

Calculate Eigenvector (π’–π’Š)

C = 10304 Γ— 10304

10304 eigenvectors

Each 10304Γ—1 dimensional

……….. 𝜳

Π€π’Š

Face vector space

Converted

………

π’–π’Š

𝑀= 16 images in the training set

Find the Significant 𝑲𝒕𝒉 eigenfaces

Where, 𝑲 < 𝑴

C = 10304 Γ— 10304

10304 eigenvectors

Each 10304Γ—1 dimensional

……….. 𝜳

Π€π’Š

Face vector space

Converted

………

π’–π’Š

𝑀= 16 images in the training set

Make system slow

Required huge calculation

Reduce

Dimensionality

Consider lower dimensional subspace

……….. 𝜳

Π€π’Š

Lower dimensional Sub-space

Face vector space

Converted

𝑀= 16 images in the training set

𝑳 = 𝑨𝑻𝑨

= 𝑴×𝑡2 𝑡2 ×𝑴

= 𝑴×𝑴

= 16 Γ— 16…… . .

16 eigenvectors

Each 16 Γ—1 dimensional

Calculate eigenvectors π’—π’Š

π’—π’Š

……….. 𝜳

Π€π’Š

Lower dimensional Sub-space

Face vector space

Converted

𝑀= 16 images in the training set

Calculate Co-variance matrix(𝑳)

of lower dimensional

𝑳 = 𝑨𝑻𝑨

= 𝑴×𝑡2 𝑡2 ×𝑴

= 𝑴×𝑴

= 16 Γ— 16…… . .

16 eigenvectors

Each 16 Γ—1 dimensional

π’–π’Š V/S π’—π’Š

π’—π’Š

……….. 𝜳

Π€π’Š

Lower dimensional Sub-space

Face vector space

Converted

10304 eigenvectors

………

Each 10304Γ—1 dimensional

π’–π’Š

C = 10304 Γ— 10304

v/s

𝑀 images in the training set

𝑳 = 𝑨𝑻𝑨

= 𝑴×𝑡2 𝑡2 ×𝑴

= 𝑴×𝑴

= 16 Γ— 16

Select K best eigenvectors

……….. 𝜳

Π€π’Š

Lower dimensional Sub-space

Face vector space

Converted

…… . .

16 eigenvectors

Each 16 Γ—1 dimensional

π’—π’Š

Selected K eigenfaces MUST be inThe ORIGINAL dimensionality of theFace vector space

Back to Original

Dimensionality

𝑳 = 𝑨𝑻𝑨

= 𝑴×𝑡2 𝑡2 ×𝑴

= 𝑴×𝑴

= 16 Γ— 16

……….. 𝜳

Π€π’Š

Lower dimensional Sub-space

Face vector space

Converted

…… . .

16 eigenvectors

Each 16 Γ—1 dimensional

π’—π’Š

A=

π’–π’Š = π‘¨π’—π’Š

10304 eigenvectors

………

Each 10304Γ—1 dimensional

π’–π’Š

𝑀= 16 images in the training set

𝑳 = 𝑨𝑻𝑨

= 𝑴×𝑡2 𝑡2 ×𝑴

= 𝑴×𝑴

= 16 Γ— 16

……….. 𝜳

Π€π’Š

Lower dimensional Sub-space

Face vector space

Converted

…… . .

16 eigenvectors

Each 16 Γ—1 dimensional

π’—π’Š

A=

π’–π’Š = π‘¨π’—π’Š

10304 eigenvectors

………

Each 10304Γ—1 dimensional

π’–π’Š

𝑀 images in the training set

C = 𝐴𝐴𝑇

10304 eigenvectors

………

Each 10304Γ—1 dimensional

π’–π’Š

The K selected eigenface

……….. 𝜳

Π€π’Š

Face vector space

Converted

𝑀= 16 images in the training set

Result of Eigenfaces Calculation

Figure: The selected K eigenfaces of our set of original images

Represent Each Face Image

a Linear Combination of all

K Eigenvectors

π›šπŸ π›šπŸ π›šπŸ‘ π›šπŸ’ π›šπŸ“ π›šπŠβ‹―β‹―β‹―

+ 𝜳 (Mean Image)

Each face from Training set can be represented a weighted sum of the K Eigenfaces + the Mean face

π›šπŸ π›šπŸ π›šπŸ‘ π›šπŸ’ π›šπŸ“ π›šπŠβ‹―

+ 𝜳 (Mean Image)

The K selected eigenface

Each face from Training set can be represented aweighted sum of the K Eigenfaces + the Mean face

………..

Π€π’Š

𝜳

Converted

Face vector space

𝑀= 16 images in the training set

Weight Vector (πœ΄π’Š)

π›šπŸ π›šπŸ π›šπŸ‘ π›šπŸ’ π›šπŸ“ π›šπŠβ‹―

+ 𝜳 (Mean Image)

= πœ΄π’Š =

𝝎1π’Š

𝝎2π’Š

𝝎3π’Š

.

.

.πŽπ‘²π’Š

Each face from Training set can be represented aweighted sum of the K Eigenfaces + the Mean face

A weight vector 𝛀𝐒 which is the eigenfaces representation of

the π’Šπ’•π’‰ face. We calculated each faces weight vector.

Recognizing An Unknown Face

Convert the

Input to Face

Vector

Normalize the

Face Vector

Project Normalize Face Vector onto the Eigenspace

Get the Weight

Vector

πœ΄π’π’†π’˜ =

πŽπŸπŽπŸπŽπŸ‘...πŽπ‘²

Euclidian Distance

(E) = (π›€π’π’†π’˜ βˆ’π›€π’Š)

If

𝑬 < πœ½π’•

No

Unknown

Yes

Input of a unknown Image

Recognized as

Thank You