eigen value analysis in pattern recognition by dr. m. asmat ullah khan comsats institute of...
Post on 21-Dec-2015
219 views
TRANSCRIPT
Eigen Value Analysis in Pattern Eigen Value Analysis in Pattern RecognitionRecognition
By
Dr. M. Asmat Ullah KhanCOMSATS Institute of Information Technology, Abbottabad
MULTI SPECTRAL IMAGE COMPRESSIONMULTI SPECTRAL IMAGE COMPRESSION
MULTI SPECTRAL IMAGE COMPRESSIONMULTI SPECTRAL IMAGE COMPRESSION
MULTI SPECTRAL IMAGE COMPRESSIONMULTI SPECTRAL IMAGE COMPRESSION
MULTI SPECTRAL IMAGE COMPRESSIONMULTI SPECTRAL IMAGE COMPRESSION
MULTI SPECTRAL IMAGE COMPRESSIONMULTI SPECTRAL IMAGE COMPRESSION
Principal Component Analysis Principal Component Analysis (PCA)(PCA)
Pattern recognition in high-dimensional spaces– Problems arise when performing recognition in a high-dimensional space
(curse of dimensionality).– Significant improvements can be achieved by first mapping the data into a
lower-dimensional sub-space.
– The goal of PCA is to reduce the dimensionality of the data while retaining as much as possible of the variation present in the original dataset.
Principal Component Analysis Principal Component Analysis (PCA)(PCA)
Dimensionality reduction– PCA allows us to compute a linear transformation that maps data from a high
dimensional space to a lower dimensional sub-space.
Principal Component Analysis Principal Component Analysis (PCA)(PCA)
Lower dimensionality basis– Approximate vectors by finding a basis in an appropriate lower dimensional
space.
(1) Higher-dimensional space representation:
(2) Lower-dimensional space representation:
Principal Component Analysis Principal Component Analysis (PCA)(PCA)
Example
Principal Component Analysis Principal Component Analysis (PCA)(PCA)
Information loss– Dimensionality reduction implies information loss !!– Want to preserve as much information as possible, that is:
How to determine the best lower dimensional sub-space?
Principal Component Analysis Principal Component Analysis (PCA)(PCA)
Methodology– Suppose x1, x2, ..., xM are N x 1 vectors
Principal Component Analysis Principal Component Analysis (PCA)(PCA)
Methodology – cont.
Principal Component Analysis Principal Component Analysis (PCA)(PCA)
Linear transformation implied by PCA– The linear transformation RN RK that performs the dimensionality reduction is:
Principal Component Analysis Principal Component Analysis (PCA)(PCA)
Geometric interpretation– PCA projects the data along the directions where the data varies the most.
– These directions are determined by the eigenvectors of the covariance matrix corresponding to the largest eigenvalues.
– The magnitude of the eigenvalues corresponds to the variance of the data along the eigenvector directions.
Principal Component Analysis Principal Component Analysis (PCA)(PCA)
How to choose the principal components?
– To choose K, use the following criterion:
Principal Component Analysis Principal Component Analysis (PCA)(PCA)
What is the error due to dimensionality reduction?– We saw above that an original vector x can be reconstructed using its
principal components:
– It can be shown that the low-dimensional basis based on principal components minimizes the reconstruction error:
– It can be shown that the error is equal to:
Principal Component Analysis Principal Component Analysis (PCA)(PCA)
Standardization
– The principal components are dependent on the units used to measure the original variables as well as on the range of values they assume.
– We should always standardize the data prior to using PCA.– A common standardization method is to transform all the data to have
zero mean and unit standard deviation:
Principal Component Analysis Principal Component Analysis (PCA)(PCA)
PCA and classification– PCA is not always an optimal dimensionality-reduction procedure for
classification purposes:
Principal Component Analysis (PCA)Principal Component Analysis (PCA) Case Study: Eigenfaces for Face Detection/Recognition
– M. Turk, A. Pentland, "Eigenfaces for Recognition", Journal of Cognitive Neuroscience, vol. 3, no. 1, pp. 71-86, 1991.
Face Recognition
– The simplest approach is to think of it as a template matching problem
– Problems arise when performing recognition in a high-dimensional space.
– Significant improvements can be achieved by first mapping the data into a lower dimensionality space.
– How to find this lower-dimensional space?
Principal Component Analysis Principal Component Analysis (PCA)(PCA)
Main idea behind eigenfaces
Principal Component Analysis (PCA)Principal Component Analysis (PCA) Computation of the eigenfaces
Principal Component Analysis Principal Component Analysis (PCA)(PCA)
Computation of the eigenfaces – cont.
Principal Component Analysis (PCA)Principal Component Analysis (PCA) Computation of the eigenfaces – cont.
Principal Component Analysis Principal Component Analysis (PCA)(PCA)
Computation of the eigenfaces – cont.
Principal Component Analysis (PCA)Principal Component Analysis (PCA) Representing faces onto this basis
Principal Component Analysis Principal Component Analysis (PCA)(PCA)
Representing faces onto this basis – cont.
Principal Component Analysis (PCA)Principal Component Analysis (PCA) Face Recognition Using Eigenfaces
Principal Component Analysis Principal Component Analysis (PCA)(PCA)
Face Recognition Using Eigenfaces – cont.
– The distance er is called distance within the face space (difs)
– Comment: we can use the common Euclidean distance to compute er, however, it has been reported that the Mahalanobis distance performs better:
Principal Component Analysis Principal Component Analysis (PCA)(PCA)
Face Detection Using Eigenfaces
Principal Component Analysis Principal Component Analysis (PCA)(PCA)
Face Detection Using Eigenfaces – cont.
Principal Component Analysis (PCA)Principal Component Analysis (PCA) Problems
– Background (de-emphasize the outside of the face – e.g., by multiplying the input image by a 2D Gaussian window centered on the face)
– Lighting conditions (performance degrades with light changes)– Scale (performance decreases quickly with changes to head size)
multi-scale eigenspaces scale input image to multiple sizes
– Orientation (performance decreases but not as fast as with scale changes)
plane rotations can be handled out-of-plane rotations are more difficult to handle
Linear Discriminant Analysis (LDA)Linear Discriminant Analysis (LDA) Multiple classes and PCA
– Suppose there are C classes in the training data.– PCA is based on the sample covariance which characterizes the scatter of the
entire data set, irrespective of class-membership.– The projection axes chosen by PCA might not provide good discrimination
power.
What is the goal of LDA?– Perform dimensionality reduction while preserving as much of the class
discriminatory information as possible.
– Seeks to find directions along which the classes are best separated.
– Takes into consideration the scatter within-classes but also the scatter between-classes.
– More capable of distinguishing image variation due to identity from variation due to other sources such as illumination and expression.
Linear Discriminant Analysis (LDA)Linear Discriminant Analysis (LDA) Methodology
Linear Discriminant Analysis Linear Discriminant Analysis (LDA)(LDA)
Methodology – cont.– LDA computes a transformation that maximizes the between-class scatter
while minimizing the within-class scatter:
– Such a transformation should retain class separability while reducing the variation due to sources other than identity (e.g., illumination).
Linear Discriminant Analysis Linear Discriminant Analysis (LDA)(LDA)
Linear transformation implied by LDA
– The linear transformation is given by a matrix U whose columns are the eigenvectors of Sw
-1 Sb (called Fisherfaces).
– The eigenvectors are solutions of the generalized eigenvector problem:
Linear Discriminant Analysis Linear Discriminant Analysis (LDA)(LDA)
Does Sw-1 always exist?
– If Sw is non-singular, we can obtain a conventional eigenvalue problem by writing:
– In practice, Sw is often singular since the data are image vectors with large dimensionality while the size of the data set is much smaller (M << N )
Linear Discriminant Analysis Linear Discriminant Analysis (LDA)(LDA)
Does Sw-1 always exist? – cont.
– To alleviate this problem, we can perform two projections:
1) PCA is first applied to the data set to reduce its dimensionality.
2) LDA is then applied to further reduce the dimensionality.
Linear Discriminant Analysis Linear Discriminant Analysis (LDA)(LDA)
Case Study: Using Discriminant Eigenfeatures for Image Retrieval– D. Swets, J. Weng, "Using Discriminant Eigenfeatures for Image
Retrieval", IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 18, no. 8, pp. 831-836, 1996.
Content-based image retrieval– The application being studied here is query-by-example image retrieval.– The paper deals with the problem of selecting a good set of image
features for content-based image retrieval.
Linear Discriminant Analysis Linear Discriminant Analysis (LDA)(LDA)
Assumptions– "Well-framed" images are required as input for training and query-by-
example test probes.– Only a small variation in the size, position, and orientation of the objects
in the images is allowed.
Linear Discriminant Analysis (LDA)Linear Discriminant Analysis (LDA) Some terminology
– Most Expressive Features (MEF): the features (projections) obtained using PCA.
– Most Discriminating Features (MDF): the features (projections) obtained using LDA.
Computational considerations– When computing the eigenvalues/eigenvectors of Sw
-1SBuk = kuk numerically, the computations can be unstable since Sw
-1SB is not always symmetric.
– See paper for a way to find the eigenvalues/eigenvectors in a stable way.
– Important: Dimensionality of LDA is bounded by C-1 --- this is the rank of Sw-1SB
Linear Discriminant Analysis (LDA)Linear Discriminant Analysis (LDA) Case Study: PCA versus LDA
– A. Martinez, A. Kak, "PCA versus LDA", IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 23, no. 2, pp. 228-233, 2001.
Is LDA always better than PCA?– There has been a tendency in the computer vision community to prefer
LDA over PCA.– This is mainly because LDA deals directly with discrimination between
classes while PCA does not pay attention to the underlying class structure.– This paper shows that when the training set is small, PCA can outperform
LDA.– When the number of samples is large and representative for each class,
LDA outperforms PCA.
Linear Discriminant Analysis (LDA)Linear Discriminant Analysis (LDA) Is LDA always better than PCA? – cont.
Linear Discriminant Analysis (LDA)Linear Discriminant Analysis (LDA) Is LDA always better than PCA? – cont.
Linear Discriminant Analysis Linear Discriminant Analysis (LDA)(LDA)
Is LDA always better than PCA? – cont.
Linear Discriminant Analysis Linear Discriminant Analysis (LDA)(LDA)
Critique of LDA– Only linearly separable classes will remain separable after applying LDA.– It does not seem to be superior to PCA when the training data set is small.
Appearance-based RecognitionAppearance-based Recognition
• Directly represent appearance (image brightness), not geometry.
• Why?
Avoids modeling geometry, complex interactions between geometry, lighting and reflectance.
• Why not?
Too many possible appearances!
m “visual degrees of freedom” (eg., pose, lighting, etc)R discrete samples for each DOF
How to discretely sample the DOFs?
How to PREDICT/SYNTHESIS/MATCH with novel views?
Appearance-based RecognitionAppearance-based Recognition
• Example:
• Visual DOFs: Object type P, Lighting Direction L, Pose R
• Set of R * P * L possible images:
• Image as a point in high dimensional space:
}ˆ{ PRLx
x is an image of N pixels andA point in N-dimensional space
x
Pixel 1 gray value
Pix
el 2
gra
y va
lue
The Space of FacesThe Space of Faces
An image is a point in a high dimensional space– An N x M image is a point in RNM
– We can define vectors in this space as we did in the 2D case
+=
[Thanks to Chuck Dyer, Steve Seitz, Nishino]
Key IdeaKey Idea
}ˆ{ PRLx• Images in the possible set are highly correlated.
• So, compress them to a low-dimensional subspace that captures key appearance characteristics of the visual DOFs.
• EIGENFACES: [Turk and Pentland]
USE PCA!
EigenfacesEigenfaces
Eigenfaces look somewhat like generic faces.
Linear SubspacesLinear Subspaces
Classification can be expensive– Must either search (e.g., nearest neighbors) or store large probability density functions.
Suppose the data points are arranged as above– Idea—fit a line, classifier measures distance to line
convert x into v1, v2 coordinates
What does the v2 coordinate measure?
What does the v1 coordinate measure?
- distance to line- use it for classification—near 0 for orange pts
- position along line- use it to specify which orange point it is
Dimensionality ReductionDimensionality Reduction
Dimensionality reduction– We can represent the orange points with only their v1 coordinates
since v2 coordinates are all essentially 0
– This makes it much cheaper to store and compare points– A bigger deal for higher dimensional problems
Linear SubspacesLinear Subspaces
Consider the variation along direction v among all of the orange points:
What unit vector v minimizes var?
What unit vector v maximizes var?
Solution: v1 is eigenvector of A with largest eigenvalue v2 is eigenvector of A with smallest eigenvalue
Higher DimensionsHigher Dimensions
Suppose each data point is N-dimensional– Same procedure applies:
– The eigenvectors of A define a new coordinate system eigenvector with largest eigenvalue captures the most variation among
training vectors x eigenvector with smallest eigenvalue has least variation
– We can compress the data by only using the top few eigenvectors corresponds to choosing a “linear subspace”
– represent points on a line, plane, or “hyper-plane” these eigenvectors are known as the principal components
Problem: Size of Covariance Matrix AProblem: Size of Covariance Matrix A
Suppose each data point is N-dimensional (N pixels)
– The size of covariance matrix A is N x N– The number of eigenfaces is N
– Example: For N = 256 x 256 pixels, Size of A will be 65536 x 65536 ! Number of eigenvectors will be 65536 !
Typically, only 20-30 eigenvectors suffice. So, this method is very inefficient!
2 2
If B is MxN and M<<N then A=BTB is NxN >> MxM
– M number of images, N number of pixels
– use BBT instead, eigenvector of BBT is easily
converted to that of BTB
(BBT) y = e y
=> BT(BBT) y = e (BTy)
=> (BTB)(BTy) = e (BTy)
=> BTy is the eigenvector of BTB
Efficient Computation of EigenvectorsEfficient Computation of Eigenvectors
Eigenfaces – summary in wordsEigenfaces – summary in words
Eigenfaces are the eigenvectors of the covariance matrix of the probability distribution of the vector space of human faces
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
Generating Eigenfaces – in wordsGenerating Eigenfaces – in words
1. Large set of images of human faces is taken.2. The images are normalized to line up the eyes,
mouths and other features. 3. The eigenvectors of the covariance matrix of the
face image vectors are then extracted.4. These eigenvectors are called eigenfaces.
Eigenfaces for Face RecognitionEigenfaces for Face Recognition
When properly weighted, eigenfaces can be summed together to create an approximate gray-scale rendering of a human face.
Remarkably few eigenvector terms are needed to give a fair likeness of most people's faces.
Hence eigenfaces provide a means of applying data compression to faces for identification purposes.
Dimensionality ReductionDimensionality Reduction
The set of faces is a “subspace” of the set of images
– Suppose it is K dimensional
– We can find the best subspace using PCA
– This is like fitting a “hyper-plane” to the set of faces
spanned by vectors v1, v2, ..., vK
Any face:
EigenfacesEigenfaces
PCA extracts the eigenvectors of A– Gives a set of vectors v1, v2, v3, ...
– Each one of these vectors is a direction in face space what do these look like?
Projecting onto the EigenfacesProjecting onto the Eigenfaces
The eigenfaces v1, ..., vK span the space of faces
– A face is converted to eigenface coordinates by
Is this a face or not?Is this a face or not?
Recognition with EigenfacesRecognition with Eigenfaces Algorithm
1. Process the image database (set of images with labels)
• Run PCA—compute eigenfaces• Calculate the K coefficients for each image
2. Given a new image (to be recognized) x, calculate K coefficients
3. Detect if x is a face
4. If it is a face, who is it?
• Find closest labeled face in database• nearest-neighbor in K-dimensional space
Key Property of Eigenspace RepresentationKey Property of Eigenspace Representation
Given
• 2 images that are used to construct the Eigenspace
• is the eigenspace projection of image
• is the eigenspace projection of image
Then,
That is, distance in Eigenspace is approximately equal to the correlation between two images.
21 ˆ,ˆ xx
1x
2x1g
2g
||ˆˆ||||ˆˆ|| 1212 xxgg
Choosing the Dimension KChoosing the Dimension K
K NMi =
eigenvalues
How many eigenfaces to use?
Look at the decay of the eigenvalues
– the eigenvalue tells you the amount of variance “in the direction” of that eigenface
– ignore eigenfaces with low variance
PapersPapers
More Problems: OutliersMore Problems: Outliers
Need to explicitly reject outliers before or during computing PCA.
Sample Outliers
Intra-sample outliers
[De la Torre and Black]
PCAPCA
RPCARPCA
RPCA: Robust PCA, [De la Torre and Black]
Robustness to Intra-sample outliersRobustness to Intra-sample outliers
OriginalOriginal PCAPCA RPCARPCA OutliersOutliers
Robustness to Sample OutliersRobustness to Sample Outliers
Finding outliers = Tracking moving objects
Research QuestionsResearch Questions Does PCA encode information related to gender, ethnicity, age, and identity
efficiently?
What information do PCA encode?
Are there components (features) of PCA that encode multiples properties?
PCAPCA The aim of the PCA is a linear reduction of D dimensional data to d dimensional
data (d<D), while preserving as much information, in the data, as possible. Linear functions
y1= w1 Xy2= w2 X***yd= wd X
Y= W X X – inputs; Y – outputs, components; W – eigenvectors, eigenfaces, basis vectors
x1
w1
w2
x2
How many components?How many components? Usual choice consider the first d PC’s which account for some percentage,
usually above 90 %, of the cumulative variance of the data. This is disadvantageous if the last components are interesting
W2
W1
x1
x2
DatasetDataset
A subset of FERET dataset 2670 grey scale frontal face
images Rich in variety: face images
vary in pose, background lighting, presence or absence of glasses, slight change in expression
Property No.Categorie
s
Categories No. Face
s
Gender 2Male 1603
Female 1067
Ethnicity 3
Caucasian 1758
African 320
East Asian 363
Age 5
20 – 29 665
30 – 39 1264
40 – 49 429
50 – 59 206
60+ 106
Identity 358Individuals with 3
or more examples
1161
DatasetDataset
Each image is pre-processed to a 65 X 75 resolution. Aligned based on eye locations Cropped such that little or no hair information is available Histogram equalisation is applied to reduce lighting effects
Does PCA efficiently represents information in face Does PCA efficiently represents information in face images?images?
Images of 65 × 75 resolution leads to a dimensionality of 4875. The first 350 components accounted for 90% variance of the data. Each face is thus represented using 350 components instead of 4875
dimensions
Classification employing 5-fold cross validation, with 80% of faces in each category for training and 20% of faces in each category for testing
for identity recognition leave-one-out method is used. LDA is performed on the PCA data Euclidean measure is used for classification
Property Classification
Gender 86.4%
Ethnicity 81.6%
Age 91.5%
Identity 90%
What information does PCA encode? – GenderWhat information does PCA encode? – Gender
Gender encoding power estimated using the LDA 3rd component carries highest gender encoding power followed by the 4th components All important components are among the first 50 components
0 10 20 30 40 500
1
2
3
4
5
6
7
8
9
Components
Gen
der
En
cod
ing
Po
wer
What information does PCA encode? – GenderWhat information does PCA encode? – Gender
Reconstructed images from the altered components (a) third and (b) fourth components. The components are progressively added by quantities of -6 S.D (extreme left) to +6 S.D (extreme right) in steps of 2 S.D.
Third component encodes information related to the complexion, length of the nose, presence or absence of hair on the forehead, and texture around the mouth region.
Fourth component encodes information related to the eyebrow thickness, presence or absence of smiling expression
-6 SD -4 SD -2 SD Mean +2 SD +4 SD +6 SD
GenderGender
(a) Face examples with the first two being female and the next two being male faces. (b) Reconstructed faces of (a) using the top 20 gender important components. (c) Reconstructed faces of (a) using all components, except the top 20 gender important components.
What information does PCA encode? – EthnicityWhat information does PCA encode? – Ethnicity
6th component carries highest ethnicity encoding power followed by the 15 th components
All ethnicity important components are among the first 50 components
0 10 20 30 40 500
1
2
3
4
5
6
7
8
9
10
Components
Eth
nic
ity
En
cod
ing
Po
wer
EthnicityEthnicity
Reconstructed images from the altered components (a) 6 th and (b) 4th components. The components are progressively added by quantities of -6 S.D (extreme left) to +6 S.D (extreme right) in steps of 2 S.D.
6th component encodes information related to complexion, broadness and length of the nose
15th component encodes information related to length of the nose, complexion, and presence or absence of smiling expression
-6 SD -4 SD -2 SD Mean +2 SD +4 SD +6 SD
What information does PCA encode? – AgeWhat information does PCA encode? – Age
0 10 20 30 40 500
1
2
3
4
5
6
7
8
9
10
Components
Ag
e E
nco
din
g P
ow
er
Age – 20-39 and 50-60+ age groups termed as young and old)
10th component is found to be the most important for age
Reconstructed images from the altered tenth component. The component is progressively added by quantities of -6 S.D (extreme left) to +6 S.D (extreme right) in steps of 2 S.D
-6 SD -4 SD -2 SD Mean +2 SD +4 SD +6 SD
What information does PCA encode? – IdentityWhat information does PCA encode? – Identity
Many components are found to be important for identity. However, their importance magnitude is small.
These components are widely distributed and not restricted to the first 50 components
0 20 40 60 80 1000
0.1
0.2
0.3
0.4
0.5
0.6
0.7
Components
Iden
tity
En
cod
ing
Po
wer
Can a single component encode multiple properties?Can a single component encode multiple properties? A grey beard informs that the person is a male and also, most probably, old. As all important components of gender, ethnicity, and age are among the first 50
components there are overlapping components. One example is the 3rd component which is found to be the most important for
gender and second most important for age
0 10 20 30 40 500
1
2
3
4
5
6
7
8
9
Components
Gen
der
En
cod
ing
Po
wer
0 10 20 30 40 500
1
2
3
4
5
6
7
8
9
10
Components
Ag
e E
nco
din
g P
ow
er
Can a single component encode multiple properties?Can a single component encode multiple properties?
Normal distribution plots of the (a) third (b) and fourth components for male and female classes of young and old age groups.
-10 -5 0 5 10 15 200
0.02
0.04
0.06
0.08
0.1
0.12
0.14
0.16
Component 3
Young maleYoung femaleOld maleOld female
-10 -5 0 5 10 150
0.02
0.04
0.06
0.08
0.1
0.12
0.14
Component 4
Young maleYoung femaleOld maleOld female
SummarySummary PCA encodes face image properties such as gender, ethnicity, age, and
identity efficiently. Very few components are required to encode properties such as
gender, ethnicity and age and these components are amongst the first few components which capture large part of the variance of the data. Large number of components are required to encode identity and these components are widely distributed.
There may be components which encode multiple properties.
Principal Component Analysis (PCA)Principal Component Analysis (PCA) PCA and classification
– PCA is not always an optimal dimensionality-reduction procedure for classification purposes.
Multiple classes and PCA– Suppose there are C classes in the training data.– PCA is based on the sample covariance which characterizes the scatter of
the entire data set, irrespective of class-membership.– The projection axes chosen by PCA might not provide good discrimination
power.
Linear Discriminant Analysis Linear Discriminant Analysis (LDA)(LDA)
What is the goal of LDA?
– Perform dimensionality reduction “while preserving as much of the class discriminatory information as possible”.
– Seeks to find directions along which the classes are best separated.
– Takes into consideration the scatter within-classes but also the scatter between-classes.
– More capable of distinguishing image variation due to identity from variation due to other sources such as illumination and expression.
Linear Discriminant Analysis Linear Discriminant Analysis (LDA)(LDA)
Angiograph Image Enhancement Angiograph Image Enhancement
Webcamera Calibration Webcamera Calibration
QUESTIONSQUESTIONS
THANKSTHANKS
1 Virtual COMSATS Inferential Statistics Lecture-20 Ossam Chohan Assistant Professor CIIT Abbottabad
1 Virtual COMSATS Inferential Statistics Lecture-17 Ossam Chohan Assistant Professor CIIT Abbottabad