glass
pen
clip
papers
heaphones

MATLAB: Principal Component Analysis

MATLAB: Principal Component Analysis

Question 1 โ€“ Face recognition

Perform a face identification task. For training, you are given 4 facial images of a person DG and 4 facial images of a person KS. For testing, you are given a facial image X that is known to be of

either DG or KS. The task is to determine the likelihood ratio ๐‘(๐‘‹|๐ท๐บ) ๐‘(๐‘‹|๐พ๐‘†)

and on that basis to

decide which of the 2 persons is depicted by X and to state the level of confidence you have in the decision.

To begin, use the Matlab function call load([folder,’images.mat’]) to load the 9 images into Matlab, where folder is the folder on your PC where the file images. Mat resides, for example folder=โ€™C:\Users\Kate\Documents\Uni\Biometrics\โ€™. The 9 images are stored in a Matlab cell array images, where bitmaps dg1โ€ฆdg4 are accessed as

images{1}โ€ฆimages{4}, ks1โ€ฆks4 as images{5}โ€ฆimages{8}, and xx1 as images{9}.

Each bitmap is a 70×50 matrix of uint8 values representing grey-scale pixels. The faces have already been extracted from larger images and normalised such that the personโ€™s right pupil is in a standard position. (You may also inspect the bmp images to confirm your result, but visual inspection and subjective judgment alone do not attract any marks!) In parts a) to c) of the question, you perform principal-component analysis on the training data.

a) Load the 8 training files into Matlab and convert each 70×50 matrix to a 3500×1 vector of double values by stacking the 50 matrix columns. Convert all values to double. Each vector then has all the 3500 components of the corresponding matrix, but double instead of uint8. [Hint: Use the Matlab functions load( ), reshape( ) and double( )]

Print the first 5 components of each (transposed) vector in your homework. [1.5 marks]

b) Determine the 3500×1 mean vector and the 3500×3500 covariance matrix of the 8 training vectors, then compute the first 7 principal axes of the feature space. [Hint: Combine the 8 training vectors into a 3500×8 matrix, then use the Matlab functions mean( ), cov( ) and eigs( )]

Print the first 5 components of the (transposed) mean vector and the top-left 5×5 components of the covariance matrix in your homework. [1.5 marks]

c) Project the training vectors onto the principal axes, thereby reducing each vector from 3500 components to 7 components. [Hint: Multiply the matrix of mean-normalised training vectors from the left with the transposed matrix of eigenvectors. Use the Matlab function repmat( ).]

Print ALL components of each (transposed) projected vector in your homework. [1 mark]

 

 

At this point, principal-component analysis is complete. Next, you have to calculate the models for Person DG and Person KS.

d) From the 4 projected training vectors of DG, compute the 7×1 DG mean vector and the 7×7 DG covariance matrix. Then diagonalise the covariance matrix. Do the same for KS. Together, the mean vector and diagonal covariance matrix of each person form that personโ€™s face model. [Hint: Use the Matlab function diag( ).]

Print ALL components of the 2 (transposed) mean vectors and ALL components of the diagonals of the 2 covariance matrices in your homework. [1 mark]

 

At this point, training is complete. Finally, you need to calculate the PDFs of the test face given, respectively, the DG model and the KS model.

e) Load the test file and convert it to a 3500×1 vector of type double as in Q1a).

Print the first 5 components of the (transposed) vector in your homework.

f) Project the test vector onto the principal axes as in Q1c). [0.5 marks]

Print ALL components of the (transposed) projected vector in your homework. [0.5 marks]

g) For each of the 2 models, determine the probability density (PDF) that the test vector is

produced by that model and calculate the likelihood ratio ๐‘(๐‘‹|๐ท๐บ) ๐‘(๐‘‹|๐พ๐‘†)

.

[Hint: Use the Matlab function mvnpdf( ).]

Print the 2 resulting PDFs, the likelihood ratio and the log10-likelihood ratio in your homework. [1 mark]

h) Finally and assuming equal priors and one-zero decision costs, state whether your statistical evidence supports the hypothesis ๐ป(๐ท๐บ|๐‘‹) that the test face belongs to Person DG or the hypothesis ๐ป(๐พ๐‘†|๐‘‹) that the test face belongs to Person KS. How confident are you of the decision? Use the likelihood ratio you calculated to support your conclusion.

Print your statement in plain English in your homework. [1 mark]

Oder Solution Now

Why Use Our Services

1.ย Professional & Expert Writers: AResearchersย only hires the best. Our writers are specially selected and recruited, after which they undergo further training to perfect their skills for specialization purposes. Moreover, our writers are holders of masters and Ph.D. degrees. They have impressive academic records, besides being native English speakers.

2.ย Top Quality Papers:ย Our customers are always guaranteed of papers that exceed their expectations. All our writers have +5 years of experience. This implies that all papers are written by individuals who are experts in their fields. In addition, the quality team reviews all the papers before sending them to the customers.

3.ย Plagiarism-Free Papers: All papers provided by AResearchers are written from scratch. Appropriate referencing and citation of key information are followed. Plagiarism checkers are used by the Quality assurance team and our editors just to double-check that there are no instances of plagiarism.

4.ย Timely Delivery:ย Time wasted is equivalent to a failed dedication and commitment. AResearchersย is known for timely delivery of any pending customer orders. Customers are well informed of the progress of their papers to ensure they keep track of what the writer is providing before the final draft is sent for grading.

5.ย Affordable Prices: Our prices are fairly structured to fit in all groups. Any customer willing to place their assignments with us can do so at very affordable prices. In addition, our customers enjoy regular discounts and bonuses. First time customer will receive three free pages on their first order.ย 

6.ย 24/7 Customer Support: At AResearchers, we have put in place a team of experts who answer to all customer inquiries promptly. The best part is the ever-availability of the team. Customers can make inquiries anytime.