Skip to content

Face Recognition using PCA and SVM on Yale, CMU-PIE and SMAI 2013 Student Datasets

Notifications You must be signed in to change notification settings

somayjain/FaceRecognition

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

This folder contains the code for Face Recognition on three datasets, which contains the following code -

1. Yale Dataset
	i. SelectData.py - 
		This python script divides the data unzipped from CroppedYale.zip into a 'selected' folder, which puts 20 images of each class in the folder. The selected images are chosen such that the Azimuthal Angle and Elevation Angles are between -25 and 25.
	ii. PCA.m - 
		This matlab file runs 4-fold PCA on the selected training set generated by SelectData.py, computes the accuracy of each fold and hence computes the mean accuracy.
		It also varies the number of eigen vectors taken for classification from 5 to 45 in steps of 5 and plots the mean image and eigen faces.
		Finally, it outputs the graph of accuracy v/s number of eigen vectors taken.
		All the output graphs and images are saved in Code/Yale_Dataset/Images.
	iii. classify.m - 
		This matlab file takes in the image filename as the argument and returns the classification label on training on the Yale Dataset.
			Eg - classify Images/demo_image.jpg
	iv. reconstruct.m - 
		This matlab file takes in the image filename which is to be reconstructed with the eigenfaces computed by training on the Yale Dataset. It outputs the reconstructed image and stores it in Code/Yale_Dataset/Images.
			Eg - reconstruct Images/demo_image.jpg
	v. verification.m - 
		This matlab file trains on the Yale Dataset and computes the ROC Curve to find the threshold to be used to verification. It takes the image name and the claimed label as the input and outputs "YES" if the claimed label is the actual label or outputs "NO" if the claimed label is not the actual label.
		It also plots the ROC Curve and saves the plot in the folder Code/Yale_Dataset/Images.
			Eg - verification Images/demo_image.jpg yaleB12
				 verification Images/demo_image.jpg yaleB21

	Note : Make sure that the Yale Dataset is unzipped in the folder and SelectData.py is run once to generate the data according to the Azimuthal and Elevation Angles.

2. CMU-PIE Dataset
	i.  PCA.m - 
		This matlab file runs 4-fold PCA on the selected training set loaded by CMUPIEData.mat, computes the accuracy of each fold and hence computes the mean accuracy.
		It also varies the number of eigen vectors taken for classification from 5 to 45 in steps of 5 and plots the mean image and eigen faces.
		Finally, it outputs the graph of accuracy v/s number of eigen vectors taken.
		All the output graphs and images are saved in Code/CMU-PIE_dataset/Images.
	ii. classify.m - 
		This matlab file takes in image filename as the argument and returns the classification label on training on the CMU-PIE dataset.
			Eg - classify Images/demo_image.jpg
	iii.reconstruct.m
		This matlab file takes in the image filename which is to be reconstructed with the eigenfaces computed by training on the Yale Dataset. It outputs the reconstructed image and stores it in Code/CMU-PIE_dataset/Images.
			Eg - reconstruct Images/demo_image.jpg
	iv. verification.m - 
		This matlab file trains on the CMU-PIE Dataset and computes the ROC Curve to find the threshold to be used to verification. It takes the image name and the claimed label as the input and outputs "YES" if the claimed label is the actual label or outputs "NO" if the claimed label is not the actual label.
		It also plots the ROC Curve and saves the plot in the folder Code/CMU-PIE_dataset/Images.
			Eg - verification Images/demo_image.jpg 1
				 verification Images/demo_image.jpg 5

	Note : Make sure that the CMUPIEData.mat is present in the folder before running any of the codes.


3. SMAI 2013 Student Dataset
	i.  SelectData.py - 
		This python script divides the SMAI2013StudentsDataset into testing and training data by rejecting the classes which have less than 5 images and keeping one of them as the testing image and others as the training images.
		Make sure that the SMAI2013StudentDataset is unzipped in the current folder before running this script.
		Directory structure required - 
			-- Code
				-- Students_Dataset
					-- SelectData.py
					-- PCA_student.m
					-- SMAI2013StudentsDataset
		On such a directory structure, the script will create 2 directories, train, test containing the training and testing data.
	ii. PCA_student.m
		This matlab script runs the PCA on the student database using hold one out method. It varies the number of eigen vectors taken for classification and plots the mean face and the eigen faces.
		It computes the accuracy with varying number of eigen vectors and plots the graph of number of eigen vectors v/s accuracy.
		All the output images are stored in Code/Students_Dataset/Images.

About

Face Recognition using PCA and SVM on Yale, CMU-PIE and SMAI 2013 Student Datasets

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published