1. Homepage
  2. Programming
  3. CITS1401 Computational Thinking with Python - Project: Facial Recognition

CITS1401 Computational Thinking with Python - Project: Facial Recognition

Engage in a Conversation
CITS1401Computational Thinking with PythonPythonUWAUniversity of Western AustraliaFacial Recognition

Overview CourseNana.COM

Face recognition (FR) is one the most widely known and used non-intrusive biometric which helps in identifying people. Given the identity of a known person, the goal of an FR system is to recognize the same person in a different scenario, for example while displaying a different expression. You can read this paper to understand more about FR under different expressions. CourseNana.COM

Your task is to help the researchers in analysing eight geodesic (surface) and eight 3D Euclidian distances between a few facial landmarks across four expressions 'Neutral', 'Angry', 'Disgust', 'Happy'. These distances on one face (in Neutral expression) can then be used to calculate similarity with the same face in different expressions or with other faces in the data set to see which faces are closer to (or look like) the reference face. Table 1 provides the details of each landmark while Figure 1 shows their location on the face. Table-2 gives you the details of the distances which will be used.  CourseNana.COM

The attached csv (comma separated values) file has the eight geodesic and 3D Euclidian distances for the four expressions mentioned above for each person. For the sake of simplicity, the Distance numbers are given instead of their names. For example, Inner-canthal width is distance number 1 and Lower jaw width is distance number 8. Your task is to write a program which fulfills the following requirements. CourseNana.COM

  CourseNana.COM

Table 1: Details of the Facial landmarks.    CourseNana.COM

Landmark Name CourseNana.COM

Location CourseNana.COM

Ex CourseNana.COM

Outer eye corners CourseNana.COM

En CourseNana.COM

Inner eye corners CourseNana.COM

N CourseNana.COM

Nasal root CourseNana.COM

Ft CourseNana.COM

Temple points CourseNana.COM

Al CourseNana.COM

Outer edge of nostrils CourseNana.COM

Ch CourseNana.COM

Outer mouth corners CourseNana.COM

Go CourseNana.COM

Joint between the two jaws CourseNana.COM

Prn CourseNana.COM

Nose Tip CourseNana.COM

Ls CourseNana.COM

Midpoint of upper lip CourseNana.COM

Li CourseNana.COM

Midpoint of lower lip CourseNana.COM

Sto CourseNana.COM

Midpoint of both lips CourseNana.COM


CourseNana.COM


CourseNana.COM

                        CourseNana.COM


CourseNana.COM

Figure 1: Facial landmarks locations on face
CourseNana.COM

CourseNana.COM


CourseNana.COM


CourseNana.COM

  CourseNana.COM

Distance  CourseNana.COM

Facial distance CourseNana.COM

LM1 CourseNana.COM

LM2 CourseNana.COM

1 CourseNana.COM

Inner-canthal width CourseNana.COM

En_L CourseNana.COM

En_R CourseNana.COM

2 CourseNana.COM

Outer-canthal width CourseNana.COM

Ex_L CourseNana.COM

Ex_R CourseNana.COM

3 CourseNana.COM

Nasal bridge length CourseNana.COM

N CourseNana.COM

Prn CourseNana.COM

4 CourseNana.COM

Nose width CourseNana.COM

Al_L CourseNana.COM

Al_R CourseNana.COM

5 CourseNana.COM

Upper Lip thickness CourseNana.COM

Ls CourseNana.COM

Sto CourseNana.COM

6 CourseNana.COM

Lower Lip thickness CourseNana.COM

Sto CourseNana.COM

Li CourseNana.COM

7 CourseNana.COM

Forehead width CourseNana.COM

FT_L CourseNana.COM

FT_R CourseNana.COM

8 CourseNana.COM

Lower jaw width CourseNana.COM

Go CourseNana.COM

Go CourseNana.COM

Table 2: List of distances used in this project. For example, Forehead width is the distance between Left Forehead (FT_L) and Right Forehead (FT_R). Similarly Inner canthal width, is the distance between the two inner eye corners: En_L and En_R.  CourseNana.COM

  CourseNana.COM

  CourseNana.COM


CourseNana.COM


CourseNana.COM

Requirements (i.e. what your program should do) CourseNana.COM

Input: CourseNana.COM

Your program must define the function main with the following syntax: CourseNana.COM

def main(csvfile, adultID, Option): CourseNana.COM

The input arguments to this function are: CourseNana.COM

       csvfile: The name of the CSV file containing the data of individuals which needs to be analysed. Below are the first two rows of a sample file. CourseNana.COM

Adult ID CourseNana.COM

Expression CourseNana.COM

Distance CourseNana.COM

GDis CourseNana.COM

LDis CourseNana.COM

E001 CourseNana.COM

Neutral CourseNana.COM

1 CourseNana.COM

48.44795743  CourseNana.COM

32.13047933 CourseNana.COM

The first row of the CSV file contains the headers “Adult ID”, “Expression”, “Distance”, “GDis” and “LDis”. From the second row, the first value of each row contains the de-identified adult ID, the expression displayed by the face, distance number (refer to Table-2), the geodesic distance and  the 3D Euclidean distance. We do not have prior knowledge about the number of subjects we have to analyse (i.e. the number of rows) that the CSV file contains. Adult ID and Expression are  strings, Distance is an integer while the remaining values are floats.  CourseNana.COM

       adultID: The ID number of the adult we have to analyse. Remember that the ID is a string and is case sensitive. CourseNana.COM

       Option: The input argument that decides the type of analysis required. It can take only one of the two string inputs: statsor FR”.  If the third input argument is stats, then the objective of the program is to carry out some statistical analysis of the adult whose ID is given in the second argument. Otherwise, if the third input argument is FRthen the objective is to perform face recognition by calculating the cosine similarity between the reference ID and other subjects. CourseNana.COM

Output: CourseNana.COM

The function is required to return the following outputs in the order provided below: CourseNana.COM

When the third input argument is “stats” then for the adult given in the input argument “adultID” CourseNana.COM

1.     OP1- A list of lists containing the minimum (non-zero)  and maximum GDis and LDis of each distance across the four expressions. For example, the minimum (non-zero) intercanthal width (geodesic and 3D Euclidean) in Neutral, Angry, Disgust and Happy expressions. There will be 8 lists inside the main list and each list will have four elements in the following order : [minimum GDis, maximum GDis, minimum LDis, maximum LDis]. The distances must be in the same order as given in Table-2. CourseNana.COM

2.     OP2- A list of lists containing the difference between the geodesic and 3D Euclidean distances for each expression. There will be 4 lists inside the main list and each list will have eight elements. CourseNana.COM

3.     OP3- A list containing the average geodesic distance of the eight distances across the four expressions. This list will have 8 elements. CourseNana.COM

4.     OP4- A list containing the standard deviation of the 3D Euclidean distance of the eight distances across the four expressions. This list will have 8 elements. The formula to calculate standard deviation is provided at the end of this project sheet. CourseNana.COM

When the third input argument is “FR”: CourseNana.COM

You will calculate the cosine similarity between the geodesic distances of the neutral expression of reference adultID and the geodesic distances of the remaining expressions of the same ID as well as the neutral expressions of the remaining subjects in the dataset. Your output will be: CourseNana.COM

1.     The ID of the person with which the reference face has the maximum cosine similarity, and CourseNana.COM

2.     The maximum cosine similarity value. The formula to calculate cosine similarity is provided at the end of this project sheet. CourseNana.COM

All returned lists should have the values in order. For example, for OP2, the main list has 4 sub-lists which should be ordered according to the expressions 'Neutral', 'Angry', 'Disgust', 'Happy'. Inside each sub-list are 8 elements for the distances which must be ordered as per Table-2. All returned numeric outputs (both in lists and individual) must contain values rounded to four decimal places (if required to be rounded off). Do not round the values during calculations. Instead round them only at the time when you save them into the final output variables. CourseNana.COM

  CourseNana.COM

Examples: CourseNana.COM

Download the ExpData_Sample.csv f ile from the folder of Project 1 on LMS or Moodle. Some examples of how you can call your program from the Python shell (and examine the results it returns) are: CourseNana.COM

  CourseNana.COM

>>> OP1,OP2,OP3,OP4 = main('ExpData_Sample.csv','E001','stats') CourseNana.COM

 >>> OP1 CourseNana.COM

[[45.0087, 48.448, 29.9972, 32.9404], [104.1724, 110.913, 93.9636, CourseNana.COM

98.5776], [33.9933, 39.7572, 34.695, 40.0872], [49.5445, 66.477, CourseNana.COM

31.0483, 34.1107], [5.5607, 9.7036, 5.4345, 9.3448], [7.4147, 8.9331, CourseNana.COM

7.4147, 8.7645], [150.0258, 175.289, 118.1052, 127.0695], [137.8113, 154.4196, 107.0492, 111.6436]] CourseNana.COM

  CourseNana.COM

>>> OP2 CourseNana.COM

[[16.3175, 10.2088, -0.5075, 34.6928, 0.3588, 0.0187, 48.2195, 46.5544], CourseNana.COM

[15.2932, 12.3354, -0.33, 18.4962, 0.1669, 0.1686, 39.2716, 45.8233], CourseNana.COM

[13.1529, 9.3969, -0.7016, 27.0089, 0.3791, 0.0, 39.5195, 36.9674], [15.4137, 10.9684, -0.6347, 24.5052, 0.1262, 0.2101, 31.9206, 26.9959]] CourseNana.COM

  CourseNana.COM

>>> OP3 CourseNana.COM

[46.7753, 106.8638, 37.9698, 58.3879, 7.5469, 8.1489,160.8882, 148.6113] CourseNana.COM

  CourseNana.COM

>>> OP4 CourseNana.COM

[1.0775, 1.6565, 2.2229, 1.1442, 1.408, 0.6276, 3.5032, 1.8129] CourseNana.COM

  CourseNana.COM

>>> ID,cossim = main('ExpData_Sample.csv','E001','FR') CourseNana.COM

  CourseNana.COM

>>> ID CourseNana.COM

'A004' CourseNana.COM

  CourseNana.COM

>>> cossim CourseNana.COM

0.9992 CourseNana.COM

  CourseNana.COM

Assumptions: CourseNana.COM

Your program can assume the following: CourseNana.COM

       Anything that is meant to be a string (i.e. header row) will be a string, and anything that is meant to be a number (i.e. data) will be a number. CourseNana.COM

       The order of columns in each row will follow the order of the headings provided in the first row.   CourseNana.COM

       The data of each individual adult will always be contiguous. It will never be spread out randomly. CourseNana.COM

       The data for each expression will always be contiguous and in the order: 'Neutral', 'Angry', 'Disgust', 'Happy'. CourseNana.COM

       The data for distance may or may not be in order as in Table-2. For example, it is possible that the 6th distance of a particular expression is listed first and the 1st distance is listed last. CourseNana.COM

       Distances can never be negative or zero. If any distance is negative or equal to zero, then replace it with 50. CourseNana.COM

       No data will be missing in the csv file. CourseNana.COM

       The main()  function will always be provided with valid input parameters. CourseNana.COM

       The formula for standard deviation and for calculating cosine similarity can be found at the end of the project sheet. CourseNana.COM

  CourseNana.COM

Important grading instruction: CourseNana.COM

Note that you have not been asked to write specific functions. This task has been left to you.  However, it is essential  that  your  program  defines  the  top-level   function main(csvfile, adult, Option) (hereafter referred to as “main()”  to save space when writing it. Note that when “main()” is written it still implies that it is defined with its three input arguments). The idea is that within main(), the program calls the other functions. (Of course, these functions may then call further functions.) This is important because when your code is tested on Moodle, the testing program will call your main() function. So, if you fail to define main(), the testing program will not be able to test your code and your submission will be graded zero. Don’t forget the submission guidelines provided at the start of the project sheet. CourseNana.COM

  CourseNana.COM

Things to avoid: CourseNana.COM

There are a few things for your program to avoid. CourseNana.COM

       You are not allowed to import any Python module. While use of many of these modules, e.g. csv or math is a perfectly sensible thing to do in production setting, it takes away much of the point of different aspects of the project, which is about getting practice opening text files, processing text file data, and use of basic Python structures, in this case lists and loops. CourseNana.COM

       Do not assume that the input file names will end in .csv. File name suffixes such as .csv and .txt are not mandatory in systems other than Microsoft Windows. Do not enforce that within your program that the file must end with a .csv or any other extension (or try to add an extension onto the provided csvfile argument), doing so can easily lead to loosing marks. CourseNana.COM

       Ensure your program does NOT call the input() function at any time. Calling the input() function will cause your program to hang, waiting for input that automated testing system will not provide (in fact, what will happen is that if the marking program detects the call(s), it will not test your code at all which may result in zero grade). CourseNana.COM

       Your program should also not call the print() function at any time. If it has encountered an error state and is exiting gracefully then your program needs to return zero as values for the cosine similarity otherwise empty lists or empty string. At no point should you print the program’s outputs instead of (or in addition to) returning them or provide a printout of the program’s progress in calculating such outputs. CourseNana.COM

  CourseNana.COM

  CourseNana.COM

Disclaimer: Although this project addresses a real-world problem, the files provided to you contain synthetically generated data.   CourseNana.COM

  CourseNana.COM

Submission: CourseNana.COM

Submit your solution on Moodle before the deadline as per details provided at the start of the project sheet. CourseNana.COM

You need to contact unit coordinator if you have special considerations or you plan to be making a submission after the mentioned due date. CourseNana.COM

Formulas: CourseNana.COM

Standard deviation is mathematically expressed as: CourseNana.COM


CourseNana.COM

You can find more details at https://en.wikipedia.org/wiki/Standard_deviation CourseNana.COM

  CourseNana.COM

  CourseNana.COM

Cosine Similarity Score CourseNana.COM


Suppose we have two lists A and B that contains the geodesic between landmarks, A = {5, 2, 1,1, 3, CourseNana.COM

5, 2, 1} and B = {4,1,12, 9,7,4,1,12} CourseNana.COM

The cosine similarity of A and B can be calculated using the below formula and the answer will be: CourseNana.COM

 ????????????????????(??, ??)  CourseNana.COM

0.5510  CourseNana.COM

You can find more details at https://en.wikipedia.org/wiki/Cosine_similarity   CourseNana.COM

  CourseNana.COM

Get in Touch with Our Experts

WeChat WeChat
Whatsapp WhatsApp
CITS1401代写,Computational Thinking with Python代写,Python代写,UWA代写,University of Western Australia代写,Facial Recognition代写,CITS1401代编,Computational Thinking with Python代编,Python代编,UWA代编,University of Western Australia代编,Facial Recognition代编,CITS1401代考,Computational Thinking with Python代考,Python代考,UWA代考,University of Western Australia代考,Facial Recognition代考,CITS1401help,Computational Thinking with Pythonhelp,Pythonhelp,UWAhelp,University of Western Australiahelp,Facial Recognitionhelp,CITS1401作业代写,Computational Thinking with Python作业代写,Python作业代写,UWA作业代写,University of Western Australia作业代写,Facial Recognition作业代写,CITS1401编程代写,Computational Thinking with Python编程代写,Python编程代写,UWA编程代写,University of Western Australia编程代写,Facial Recognition编程代写,CITS1401programming help,Computational Thinking with Pythonprogramming help,Pythonprogramming help,UWAprogramming help,University of Western Australiaprogramming help,Facial Recognitionprogramming help,CITS1401assignment help,Computational Thinking with Pythonassignment help,Pythonassignment help,UWAassignment help,University of Western Australiaassignment help,Facial Recognitionassignment help,CITS1401solution,Computational Thinking with Pythonsolution,Pythonsolution,UWAsolution,University of Western Australiasolution,Facial Recognitionsolution,