Facial Recognition

1 of
Published on Video
Go to video
Download PDF version
Download PDF version
Embed video
Share video
Ask about this video

Page 1 (0s)

Facial Recognition.

Page 2 (6s)

Name ID ميار محمود خليل 19016750 ميار مصطفى حسن عبد الله 19016751 سناء محمد مصطفى 19015796 نورهان شريف السيد 19016816 عبد الرحمن محمد عبد القادر حسن 19017525 يوسف محمد أحمد تاج الدين 19016940 عاصم محمد السعيد 19015872.

Page 3 (18s)

Outlines : I. Principal Component Analysis (PCA). 1. Introduction. 2. How does PCA work. 3. How do you do PCA. 4. Example. II. F acial recognition. 1. Introduction. 2.Image representaion in computer. 3. Face space..

Page 4 (34s)

First: Principal Component Analysis. Introduction: If we measure one gene of mice, we can simply plot the data on the number line. If we measure two genes, we can plot the data on the XY graph..

Page 5 (54s)

If we measure three genes, we will add another axis to the graph..

Page 6 (1m 7s)

If we measure 4 genes, we now need 4 dimensions. So we can no longer plot the data. We will talk about how PCA can allow us to deal with 4 or more dimensions of data and..

Page 7 (1m 24s)

What is Principal Component Analysis?. Principal Component Analysis (PCA) is a dimensionality-reduction method. It is often used to reduce the dimensionality of large data sets. This is done by transforming a large set of variables into a smaller one that still contains most of the information in the large set..

Page 8 (1m 40s)

Reducing the number of variables of a data set naturally comes at the expense of accuracy, but the trick in dimensionality reduction is to trade a little accuracy for simplicity. Because smaller data sets are easier to explore and visualize. So the idea of PCA is to reduce the number of variables of a data set and at the same time preserving as much information as possible..

Page 9 (2m 0s)

How does PCA work?. To understand how PCA works, suppose we have a dataset which has 300 columns. So we have a dataset with 300 dimensions. At most of the times, we don’t need so many dimensions. So we need to find an easy way to not just remove a certain number of features, but to catch the essence of the 300-dimensional data in a much smaller number of transformed dimensions..

Page 10 (2m 21s)

Variance: Variance is a change in the values throughout the data. Each of the 300 features would be having a certain amount of variance . If a feature describes number of floors in a particular building for 200 days, its variance will be 0. As there is no change in its value throughout. Features with 0 variance are useless as they provide no insights. More the variance, more is the importance of that feature as it contains more ‘information’. A variable with 0 variance contains 0 information..

Page 11 (2m 44s)

Principal Components: We will find a new set of transformed feature set which can explain the variance in a much better way. The original 300 features are used to make linear combinations of the features in order to push all the variance in a few transformed features. These transformed features are called the Principal Components..

Page 12 (3m 1s)

For example, if the first PC explains 68% of the total variance in data, the second feature explains 15% of the total variance and the next four features make up the total variance of 14%. That means we have 97% of the variance explained by just 6 Principal Components. Suppose the following 100 features in total explain another 1% of the total variance. Now it doesn’t make sense to include 100 extra dimensions just to get a percent of variance more. So by taking the first 6 Principal Components, we have reduced the dimensionality from 300 to only 6..

Page 13 (3m 27s)

How do we do Principal Component Analysis? Standardization. Covariance matrix computing. Compute the eigenvectors and eigenvalues. Feature vector. Recast the along the principal component axis..

Page 14 (3m 39s)

1-Standardization: The reason why it is critical to perform standardization is that if there are large differences between the ranges of initial variables, those variables with larger ranges will dominate over those with small ranges which will lead to biased results. So, transforming the data to comparable scales can prevent this problem. Mathematically, this can be done by subtracting the mean and dividing by the standard deviation for each value of each variable as the following law:.

Page 15 (4m 2s)

2- Covariance matrix computing: We do this step to see if there is any relationship between them. Because sometimes, variables are highly correlated in such a way that they contain redundant information. So, in order to identify these correlations, we compute the covariance matrix. The covariance matrix is a p × p symmetric matrix (where p is the number of dimensions) . For example, for a 3-dimensional data set with 3 variables x, y, and z, the covariance matrix is a 3×3 matrix of this from:.

Page 16 (4m 27s)

What do the covariances that we have as entries of the matrix tell us about the correlations between the variables? It’s actually the sign of the covariance that matters : if positive then : the two variables increase or decrease together (correlated) if negative then : One increases when the other decreases (Inversely correlated)..

Page 17 (4m 44s)

3-Compute the eigenvectors and eigenvalues of covariance matrix: principal components represent the directions of the data that explain a maximal amount of variance, that is to say, the lines that capture most information of the data. As there are as many principal components as there are variables in the data, principal components are constructed in such a manner that the first principal component accounts for the largest possible variance in the data set..

Page 18 (5m 5s)

Chart, histogram Description automatically generated.

Page 19 (5m 18s)

Chart, scatter chart Description automatically generated.

Page 20 (5m 51s)

4- Feature vector: In this step, what we do is, to choose whether to keep all these components or discard those of lesser significance and form with the remaining ones a matrix of vectors that we call Feature vector. This makes it the first step towards dimensionality reduction, because if we choose to keep only p eigenvectors (components) out of n, the final data set will have only p dimensions.

Page 21 (6m 11s)

5- Recast the along the principal component axes Until now you do not make any changes on the data, you just select the principal components and form the feature vector, but the input data set remains always in terms of the original axes. In this step, which is the last one, the aim is to use the feature vector formed using the eigenvectors of the covariance matrix, to reorient the data from the original axes to the ones represented by the principal components This can be by multiplying the transpose of the original data set by the transpose of the Feature vectors as the following law:.

Page 22 (6m 40s)

Example:. We have a simpler example with only 2 features..

Page 23 (6m 49s)

We will shift the data, so the center A is top of the origin (0,0) on the graph..

Page 24 (7m 8s)

PCA can also maximize the distance of the projected points on the best fit line from the point A..

Page 25 (7m 19s)

The distance d1 is the distance of the point 1 with respect to the origin. Similarly, d2,d3,d4,d5,d6 will be the relevant distances of the projected points from the origin..

Page 26 (7m 39s)

Assume that the slope of the line is 0.25. This means the line consists of 4 parts of feature 1 and 1 part of feature 2. This would look something like this:.

Page 27 (7m 53s)

PCA scales these values so that the vector A is of unit length long. Hence A=1, B=4/4.12 = 0.97 & C=1/4.12 = 0.242. The unit vector A is the eigenvector. The Sum of Squared Distances d1,d2,d3,d4,d5,d6 is the eigenvalue..

Page 28 (8m 11s)

Now, the Principal Component 2 will be the vector orthogonal to PC. That will be something like the red line:.

Page 29 (8m 23s)

Explained Variance:. We calculated the Sum of Squared Distances for both the principal components. If we divide those values by n-1 (where n is the sample size), we will get the variance for the respective principal component..

Page 30 (8m 37s)

So PC1 accounts for 15/18 which is equal to 0.83 or 83% of the total variance in the data. And PC2 accounts for 3/18 which is equal to 0.17 or 17% of the total variance in the data..

Page 31 (8m 54s)

If we measure 4 genes per mouse, we would not be able to draw a 4-dimensional graph of the data..

Page 32 (9m 8s)

We can do the PCA math and looking at the scree plot..

Page 33 (9m 19s)

Face Recognition Introduction: Face reorganization is one of the eveloped various skills to make computer capable of identifying people which now very important for security and some of medicine applications, linear algebra is used to make facial reorganization possible in machine learning using Eigen faces and PCA , so computer could detect people and recognize them through a certain algorithm..

Page 34 (9m 38s)

Images representation In Computer : Images in computer are saved as pixels , each pixel has mathematical value , here we converts images to greyscale images for example if each pixel is expressed in a byte value , so each value between 0 and 255 is a color between black(0) and white (255), so image is a pixels matrix of size n×m.

Page 35 (9m 55s)

To save a group of images in a single matrix let it be A where each row in it represents single image , to do that we need to do matrix to row transformation for each image by we simply “collapse” the rows of a matrix into a single row.

Page 36 (10m 10s)

Face space: It is the space of faces that contains all the face images in our data spanned by a group of vectors called Eigen faces ,which we will get using PCA..

Page 37 (10m 32s)

1-Mean Face : first we will get the the mean face of the faces , we can do that by getting the average of each pixel of all face images . 2-difference faces : we want to calculate the deviation of each image from the mean face so that we neglect the similarities between faces which doesn’t represent special feature for the image , we do that easily by subtracting the mean face image from each of face images so A matrix is converted to difference matrix.

Page 38 (10m 58s)

. ميار مصطفى.

Page 39 (11m 3s)

4-Eigen faces : we will get Eigen vectors Eigen values of the covariance matrix ,when we apply vector to matrix conversion to Eigen vectors so they return to normal picture form ,they forms Eigen faces ,which is something like that:.

Page 40 (11m 18s)

5-reduced eigen face space : The Eigen faces spanning the face space , so with a sum of the mean and a linear combination of them we can get the original face images , but we have very large no of Eigen faces(dimensions) equals to no of pixels in each image so we need to do dimension reduction by choosing the most important of them ,which are the most variety Eigen faces ,the more variety Eigen face has the more its Eigen value is , so we will arrange Eigen values in descending order , and choose K no of most bigger Eigen values out of d Eigen values which makes the following satisfying and near to be 1,.

Page 41 (11m 48s)

6-Projecting in the new space: Once the eigenfaces have been optioned , the image in the database are projected into the eigenface space and the weights of the image in the space are stored..

Page 42 (12m 1s)

7-Comparing eigencoefficients: To determine the identity of an image, the eigencoefficients of it are compared with the eigencoefficients in the database. After we form the eigenface of the input image (x), we calculate Euclidian distances between it and the eigenfaces stored previously..

Page 43 (12m 18s)

8-Recognization: The person in the input image is identified as the one whose Euclidian distance is minimum below a threshold value in the eigenface database. If all the distances are larger than the threshold then the image is unrecognizable. Notes : The pictures constituting the training set should have been taken under the same lighting conditions, and must be normalized to have the eyes and mouths aligned across the image. They must also be all resampled to a common pixel resolution (r*c) We can use the same approach in Face Detection (detect if it is a face or not)..