ENEE633 Project Report SVM Implementation for Face Recognition

Similar documents
A Practical Guide to Support Vector Classification

FACE RECOGNITION USING SUPPORT VECTOR MACHINES

GENDER CLASSIFICATION USING SUPPORT VECTOR MACHINES

Equation to LaTeX. Abhinav Rastogi, Sevy Harris. I. Introduction. Segmentation.

Linear Discriminant Analysis in Ottoman Alphabet Character Recognition

Feature Ranking Using Linear SVM

Modelling and Visualization of High Dimensional Data. Sample Examination Paper

Support Vector Machines

Combining SVMs with Various Feature Selection Strategies

Learning to Recognize Faces in Realistic Conditions

MATLAB/OCTAVE interface of LIBSVM

IMPROVED FACE RECOGNITION USING ICP TECHNIQUES INCAMERA SURVEILLANCE SYSTEMS. Kirthiga, M.E-Communication system, PREC, Thanjavur

Face Recognition using SURF Features and SVM Classifier

Dimension Reduction CS534

Linear Discriminant Analysis for 3D Face Recognition System

A KERNEL MACHINE BASED APPROACH FOR MULTI- VIEW FACE RECOGNITION

Fuzzy Bidirectional Weighted Sum for Face Recognition

Data Mining Final Project Francisco R. Ortega Professor: Dr. Tao Li

Assignment 2. Classification and Regression using Linear Networks, Multilayer Perceptron Networks, and Radial Basis Functions

Classification of Subject Motion for Improved Reconstruction of Dynamic Magnetic Resonance Imaging

Facial Expression Classification with Random Filters Feature Extraction

Automatic Fatigue Detection System

Class-dependent Feature Selection for Face Recognition

CSE 152 : Introduction to Computer Vision, Spring 2018 Assignment 5

Content-based image and video analysis. Machine learning

All lecture slides will be available at CSC2515_Winter15.html

Two-View Face Recognition Using Bayesian Fusion

FEATURE SELECTION TECHNIQUES

A Novel Smoke Detection Method Using Support Vector Machine

Robust Face Recognition via Sparse Representation Authors: John Wright, Allen Y. Yang, Arvind Ganesh, S. Shankar Sastry, and Yi Ma

Available online at ScienceDirect. Procedia Computer Science 93 (2016 )

Feature Selection. CE-725: Statistical Pattern Recognition Sharif University of Technology Spring Soleymani

Support Vector Machines: Brief Overview" November 2011 CPSC 352

CSC 411: Lecture 14: Principal Components Analysis & Autoencoders

On the Impact of Outliers on High-Dimensional Data Analysis Methods for Face Recognition

EFFICIENT SCARF DETECTION PRIOR TO FACE RECOGNITION

Three-Dimensional Face Recognition: A Fishersurface Approach

An Empirical Study of Lazy Multilabel Classification Algorithms

ECE 285 Class Project Report

A Practical Guide to Support Vector Classification

COSC160: Detection and Classification. Jeremy Bolton, PhD Assistant Teaching Professor

CHAPTER 3 PRINCIPAL COMPONENT ANALYSIS AND FISHER LINEAR DISCRIMINANT ANALYSIS

CANCER PREDICTION USING PATTERN CLASSIFICATION OF MICROARRAY DATA. By: Sudhir Madhav Rao &Vinod Jayakumar Instructor: Dr.

Noise-based Feature Perturbation as a Selection Method for Microarray Data

The Curse of Dimensionality

Kernel Methods and Visualization for Interval Data Mining

Principal Component Image Interpretation A Logical and Statistical Approach

Open Access Research on the Prediction Model of Material Cost Based on Data Mining

Automated Canvas Analysis for Painting Conservation. By Brendan Tobin

Study of Viola-Jones Real Time Face Detector

IEEE TRANSACTIONS ON NEURAL NETWORKS, VOL. 14, NO. 1, JANUARY Face Recognition Using LDA-Based Algorithms

Univariate Margin Tree

Deep Learning for Computer Vision

Face Recognition for Mobile Devices

CSC 411: Lecture 14: Principal Components Analysis & Autoencoders

Inf2B assignment 2. Natural images classification. Hiroshi Shimodaira and Pol Moreno. Submission due: 4pm, Wednesday 30 March 2016.

Online Mathematical Symbol Recognition using SVMs with Features from Functional Approximation

Chap.12 Kernel methods [Book, Chap.7]

Discriminate Analysis

Data Mining: Data. Lecture Notes for Chapter 2. Introduction to Data Mining

CS 195-5: Machine Learning Problem Set 5

Accelerometer Gesture Recognition

The Novel Approach for 3D Face Recognition Using Simple Preprocessing Method

Bagging and Boosting Algorithms for Support Vector Machine Classifiers

A Survey on Feature Extraction Techniques for Palmprint Identification

An Effective Performance of Feature Selection with Classification of Data Mining Using SVM Algorithm

Machine Learning Final Project

Analyzing Vocal Patterns to Determine Emotion Maisy Wieman, Andy Sun

An Integrated Face Recognition Algorithm Based on Wavelet Subspace

Dimension Reduction in Network Attacks Detection Systems

Machine Learning with MATLAB --classification

Opinion Mining by Transformation-Based Domain Adaptation

On Modeling Variations for Face Authentication

NIST. Support Vector Machines. Applied to Face Recognition U56 QC 100 NO A OS S. P. Jonathon Phillips. Gaithersburg, MD 20899

Multidirectional 2DPCA Based Face Recognition System

ViFaI: A trained video face indexing scheme

Face recognition using Singular Value Decomposition and Hidden Markov Models

ENSEMBLE RANDOM-SUBSET SVM

Principal Component Analysis (PCA) is a most practicable. statistical technique. Its application plays a major role in many

A Distance-Based Classifier Using Dissimilarity Based on Class Conditional Probability and Within-Class Variation. Kwanyong Lee 1 and Hyeyoung Park 2

Application of Principal Components Analysis and Gaussian Mixture Models to Printer Identification

Efficient Voting Prediction for Pairwise Multilabel Classification

Support Vector Machines

Data Mining Final Project on NIPS Competition 2003

Applying Supervised Learning

LECTURE 5: DUAL PROBLEMS AND KERNELS. * Most of the slides in this lecture are from

Semi-Supervised Clustering with Partial Background Information

LRLW-LSI: An Improved Latent Semantic Indexing (LSI) Text Classifier

Face Recognition Using Vector Quantization Histogram and Support Vector Machine Classifier Rong-sheng LI, Fei-fei LEE *, Yan YAN and Qiu CHEN

Facial Expression Detection Using Implemented (PCA) Algorithm

Robust Face Recognition via Sparse Representation

Gaussian Mixture Model Coupled with Independent Component Analysis for Palmprint Verification

A NEW VARIABLES SELECTION AND DIMENSIONALITY REDUCTION TECHNIQUE COUPLED WITH SIMCA METHOD FOR THE CLASSIFICATION OF TEXT DOCUMENTS

Robustness of Selective Desensitization Perceptron Against Irrelevant and Partially Relevant Features in Pattern Classification

A Hierarchical Face Identification System Based on Facial Components

CROWD DENSITY ANALYSIS USING SUBSPACE LEARNING ON LOCAL BINARY PATTERN. Hajer Fradi, Xuran Zhao, Jean-Luc Dugelay

Clustering and Visualisation of Data

Data Mining - Data. Dr. Jean-Michel RICHER Dr. Jean-Michel RICHER Data Mining - Data 1 / 47

PCA and KPCA algorithms for Face Recognition A Survey

Artificial Neural Networks (Feedforward Nets)

Transcription:

ENEE633 Project Report SVM Implementation for Face Recognition Ren Mao School of Electrical and Computer Engineering University of Maryland Email: neroam@umd.edu Abstract Support vector machine(svm) is a very popular way to do pattern classification. This paper describes how to implement an support vector machine for face recognition with linear, polynomial and rbf kernel. It also implements principal component analysis and Fisher linear discriminant analysis for dimensionaly reduction before the classification. It implements svm classifier in MATLAB based on libsvm interface as well as scaler and parameter selector, which uses cross validation to find the optimal parameters for each kernel of classifiers. To apply svm on multiclass problem, it applies the one-against-one method due to its simplicity and good performance. It measures and compares different classifiers performance in terms of accuracy and gives the best parameters with the cross validation accuracy for each kernel under different scenarios including different selected training samples such as expressions and illuminations variations, and the amount of training data. I. INTRODUCTION Support vector machines (SVMs) have become a widely studied and applied classification technique, especially used in face recognition. In order to find out the best practices of SVM classifiers, we need to test different scenarios and measure accuracy under best parameters. In this project, I investigate various ways to implement SVM classifiers for face recognition and compare the differences of them. Specifically, the implementation is based on Matlab and libsvm interface, which provides multiclass classification with different kernels and cross validation for parameter classification. Firstly I implement a scaler to do preprocessing on train and test data. Secondly I implement PCA and LDA to reduce the dimension of input data, which is optional. Then I implement a grid-search algorithm to find the best parameters for different kernels under different scenarios. For each possible candidate parameter, I test 5-fold cross validation on train data to evaluate the performance of models. With the best parameters, I use the training data to get an optimal SVM model and test it with the test data to get the final result. This article mainly i) describes how to scale the training data and testing data for preprocessing, ii) describes how to run cross validation to select the best parameters for linear, polynomial and rbf kernel SVM, and iii) describes the performed experiments and their results as well as the comparison of different classifiers. The article is organized as follows: section II describes how to employ the different methods of classification and the ways to select paramters. Section III provides the experiments result under different scenarios in table and figure, and compares all these methods. Section IV gives the conclusion of this project. II. METHODS EMPLOYED In this project, I employ the SVM classifier on Matlab (version 2013a) with libsvm interface. The procedure is as flowchart in Fig.1. Firstly, I split the original data into train set and test set according to selected index for test set. Then I use the train set data as input to do dimensionality reduction, which includes PCA, LDA or no change. With the weight matrix computed in PCA/LDA, I transformed the test data set into the same space as train set. On different transformed data(or the original data) set, I conducted preprocessing to scale the train data and test data into [0, 1] range. With the scaled train data, I run grid-search algorithm to select the optimal parameters for each SVM with linear/polynomial/rbf kernels. Then I use the best parameters to get the svm model and compares the accuracy on test data. Therefore, I could have three classifiers under three transformation ways which gives nine different methods to employ the face recognition. A. Preprocessing Scaler Scaling before applying SVM is very important. The main advantage of scaling is to avoid attributes in greater numeric ranges dominating those in smaller numeric ranges. Another advantage is to avoid numerical difficulties during the calculation. Because kernel values usually dep on the inner products of feature vectors such as linear and polynomial kernel, large attribute values might cause numerical problems. Therefore, I linearly scale each attribute to the range [0,1]. mi = min( traindata,[,1) ; scale = spdiags (1./( max(traindata,[,1) min(traindata,[,1) ),0, vec size, vec size ) ; traindata = ( traindata repmat(mi,size( traindata,1),1) ) scale ; testdata = ( testdata repmat(mi,size( testdata,1),1) ) scale ;

Original Data Test Set Classification Result Train Set Dimensionality Reduction Transformed Test Set Scaler SVM Classifier PCA LDA Weight Vectors Scaling Vectors SVM Train SVM Model Transformed Train Set Scaler Parameter Selection Optimal parameters Linear Polynomial rbf Fig. 1. Flowchart of Classification Notice that the testdata should be scaled with the same parameters as traindata so that the samples are in the consistent space. B. Model Selection In this project, I compared three common kernels in SVM: linear, polynomial, rbf kernels. After decided the kernel, the parameters should be selected. 1) Linear/Polynomial/RBF Kernel: The most trivial kernel is linear kernel, which actually directly uses the inner products of original data. This is useful when the features are already very large. The parameter to be determined is only the cost parameter C. Polynomial kernel maps the data into higher dimension space, which could better describes the classification of data samples. Besides the cost parameter C, it also has another parameter d, which is the degree of polynomial kernel. In general, the RBF kernel is a reasonable first choice to train the model. This kernel nonlinearly maps samples into a higher dimensional space so it, unlike linear kernel, can handle the case when the relation between class labels and features are nonlinear. Another reason is the number of hyperparameters which influences the complexity of model selection. The polynomial kernel has more hyperparameters than RBF kernel. For RBF kernel, we need to determine two parameters (C, γ). And if the features are very large, it may not be suitable for using RBF kernel, while linear kernel should be directly used. 2) Cross-validation and Grid-search: For each kernel, we have one or two parameters unknown. In order to find the best parameters under given train data, we have to use some parameter search algorithm. The goal is to identify good parameter so that the classifier could accurately predict unknown test data. The common way to do this is to use cross-validation strategy. In v-fold cross-validation, we first divide the training set into v subsets of equal size. Sequentially one subset is tested using the classifier trained on the remaining v 1 subsets. Thus, each instance of the whole training set is predicted once so the cross-validation accuracy is the percentage of data which are correctly classified. As the parameters are unknown, I use grid-search method on potential parameters sets using cross-validation. Various pairs of parameters values are tried and the one with the best cross-validation accuracy is picked. And the candidates of parameters are exponentially growing sequences. The following is piece of code for grid-search: max = 0; options = [option, kernel ]; for c = crange for p = prange parameters = sprintf ( c %f,c); if kernels == 0 parameters = sprintf ( c %f,c); else if kernels == 1 parameters = sprintf ( c %f d %f,c,p); else if kernels == 2

parameters = sprintf ( c %f g %f,c,p); cur = [option, kernel, fold, parameters ]; acc = svmtrain( trainlabel, traindata, cur) ; if acc > max max = acc; options = [option, kernel, parameters ]; C. LIBSVM: One-against-one multiclass approach In the libsvm, the one-against-one method is used to implement multiclass. This method constructs k(k 1)/2 classifiers where each one is trained on data from two classes. For training data from the ith and the jth classes, it will solve the binary classification problem. After those classifiers are constructed, the Max Wins voting strategy is used to predict the result. In another words, it will vote for the result class in each binary classifier and predict the data x is in the class with the largest vote. Note that the libsvm implements the one-against-one approach in the way that all k(k 1)/2 classifiers are using the same parameters. The following code is the typical way of using libsvm, where RBF kernel with parameters (C, γ) = (1, 2 5 ) is used.: options = q s 0 t 2 c 1 g 0.03125 ; model = svmtrain( trainlabel, traindata, options ) ; [ predictions, acc, ] = svmpredict( testlabel, testdata,model, q ); D. Principal Component Analysis Principal Component Analysis is always used to reduce the dimensionality of original data set, the basic approach is to compute the eigenvectors of the covariance matrix and then project the original data to the space consist of those eigenvectors. The transformed feature vector is the projection coefficients. Since here sample in all the class are from the same group, which is face of human, it is appropriate to use the whole training dataset to do PCA. u = mean(train,2) ; w = train u ones(1,num wn); [vec,d] = eig(w w ); [d, sorted ] = sort(diag(d), desc ) ; vec = vec (:, sorted ) ; k = 1; while k < vec size 1 && sum(d(1:k))/sum(d) < threshold && d(k+1) > 0 k = k+1; vec (:, k+1:) = []; As the above code describes, I sort the eigenvectors as descing of eigenvalues and choose the top vectors, which the energy reaches the threshold(0.95), as basis to transform all data into lower dimensional. E. Fisher Linear Discriminant Analysis Other than the PCA, LDA produces an optimal linear discriminant functions which maps the data into classification space by taking the class distribution into consideration. The basic approach is to find the generalized eigenvalues and eigenvectors as following form: S B w i = λ i S W w i (1) where, S W is the with-in class scatter matrix and S B is the between-class scatter matrix. Once again, the issue due to small training sample set is that the S W is singular which may gives incorrect eigenvectors if we just use eig function in Matlab to compute the generalized eigenvalues. The way I do here is to use a two-phase projection: 1.) find the orthogonal basis of S W and project the data into this non-null space respect to S W ; 2.) in that space, recalculate the scatter matrices and do normal LDA, where the S w will be full-rank and lead us easy to get eigenvectors. if (rank(sw) < vec size) fprintf ( Projecting data into non null space due to singular Sw\dots\n ); T = orth(sw); train = cellfun (@(x) T. x, train, UniformOutput, false ) ; test = cellfun (@(x) T. x, test, UniformOutput, false ) ;

% Do LDA again on lower dimensional space u = cellfun (@(x) mean(x,2), train, UniformOutput, false ) ; si = cellfun (@(x,y) (x y ones(1,size(x,2) )) (x y ones(1,size(x,2) )), train,u, UniformOutput, false ) ; sw = sum(cat(3,si {:}),3) /( num wn); A. Classifier Comparison III. EXPERIMENTS AND RESULTS To compare the SVM with different kernels I implemented, I choose the first half(lower integer) of all data set as the testing data and others are training data to get the accuracy results as Table I and Fig. 2 : TABLE I ACCURACY OF CLASSIFIERS ON DIFFERENT DATASET Method data.mat pose.mat illumination.mat Ori PCA LDA Ori PCA LDA Ori PCA LDA Linear 65% 77% 80% 95.1% 86.7% 91.9% 99.1% 90.9% 99.6% Polynomial 61% 69% 81% 94.9% 88.9% 92.2% 92.1% 96.6% 99.7% RBF 61% 68.5% 80% 96.6% 90.7% 91.9% 91.7% 98.4% 99.7% 1 0.9 Linear Polynomial RBF 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 Ori data PCA data LDA data Ori pose PCA pose LDA pose Ori illumination PCA illumination LDA illumination Different dataset Fig. 2. of classifiers on Different Dataset, the test data are first lower half of the total From the results, we could see that: When the number of features are much larger then the number of samples, which would happen in the original data set, the performance of linear kernel would be better then polynomial and RBF kernel. This is because of features are enough and no need to map into higher dimension. When we mapped the data into lower dimension by PCA/LDA, the rbf kernel and polynomial kernel are usually better than linear kernel since the features are much less and might be necessary to be mapped into nonlinear space. The performance of classifiers in LDA data set are usually better than original/pca dataset since LDA would transform data into space helps to classification. Note from the results, the pose data set would give us an opposite performance, where the SVM on original dataset has better accuracy. This might be resulted from the side effects of dimensionality reduction. B. Effects of Training Data To investigate the effects of training data, I firstly iterate to see how the classification accuracy varies as the amount of training data is changed. Fig. 3 shows the accuracy of classification in pose dataset. From this figure, we can see that the The accuracy is apparently increased as the amount of training data is increased for all different kernel SVM classifiers. As the samples are increased, the SVM on original data set is better than PCA/LDA dataset. This might because of information loss and noise addition while doing PCA and LDA.

2 3 4 5 6 7 8 9 10 11 100 100 100 90 Original Dataset PCA Dataset LDA Dataset 90 Original dataset PCA dataset LDA dataset 90 Original Dataset PCA Dataset LDA Dataset 80 80 80 70 70 70 60 50 60 60 40 50 50 30 40 Training Samples/Class 40 2 3 4 5 6 7 8 9 10 11 Training Samples/Class 20 2 3 4 5 6 7 8 9 10 11 Training Samples/Class Fig. 3. of Classification on pose data: a) linear b) polynomial c) rbf It can be seen that the SVM on LDA data set is generally better than PCA dataset since LDA transforms data into space which helps classification. Then, I also investigate the effects of selected training data by changing the partition of data.mat set. In the data.mat set, we have neutral face, expression face and illumination face. So I fixed the amount of training samples as two, choose each of the image as test sample, others as training samples to see how the accuracy varies. The Table II shows the results of different test sample. TABLE II ACCURACY OF CLASSIFICATION ON DATA.MAT Test Sample Linear Polynomial RBF Ori PCA LDA Ori PCA LDA Ori PCA LDA Neutral Face 61% 77% 80% 61% 69% 81% 61% 68.5% 80% Face with expression 58% 64.5% 69% 56% 61.5% 66.5% 56% 64% 69% Face with illumination 60.5% 69.5% 49.5% 60% 65.5% 50% 60% 68.5% 49.5% From the table, we can figure out that : For SVM classifiers, it is better to take the variation samples as training samples since their common features may be still helpful for classification. And thus the accuracy would be better then using neutral face as training samples. For linear kernel SVM, the performance after LDA is better than original dataset except we take face with illumination as test sample. This might because of the characteristics of training sample would be sensitive to illuminations for support vectors. For LDA dataset, the rbf kernel SVM performs almost exactly the same as linear kernel SVM. This might because that the LDA makes the data almost linear separable where linear kernel and rbf kernel are equivalent. When we take the illumination sample as one of training sample, the LDA accuracy may be much better than PCA accuracy, which makes sense since the PCA is to project data according to variation direction and is not sensitive to the global change such as illuminations. IV. CONCLUSION In this project, I implement and compare different methods of SVM classifiers: linear, polynomial, rbf kernel and also PCA and LDA. To correctly apply SVM, I implement preprocessing scaler to avoid the numerical dominance issues. Also I implement grid-search algorithm to select parameters for each SVM based on 5-fold cross-validation. I performed several experiments on different datasets to compare the classifiers and test the effects of variations as well as amount of training data. The result shows that different classifier may have different properties. Usually, the rbf kernel SVM is better then others on low-dimensional feature space such as data after PCA/LDA. Nevertheless, the linear kernel is good enough for the original dataset since the number of features are large enough and the parameters to be determined are less then rbf/polynomial, which could save computation time. REFERENCES [1] Asa Ben-Hur and Jason Weston. A users guide to support vector machines. In Data mining techniques for the life sciences, pages 223 239. Springer, 2010. [2] Chih-Chung Chang and Chih-Jen Lin. LIBSVM: A library for support vector machines. ACM Transactions on Intelligent Systems and Technology, 2:27:1 27:27, 2011. Software available at http://www.csie.ntu.edu.tw/ cjlin/libsvm.

[3] Koby Crammer and Yoram Singer. On the algorithmic implementation of multiclass kernel-based vector machines. The Journal of Machine Learning Research, 2:265 292, 2002. [4] Richard O Duda, Peter E Hart, and David G Stork. Pattern classification. John Wiley & Sons, 2012. [5] Md Omar Faruqe and M Al Mehedi Hasan. Face recognition using pca and svm. In Anti-counterfeiting, Security, and Identification in Communication, 2009. ASID 2009. 3rd International Conference on, pages 97 101. IEEE, 2009. [6] Chih-Wei Hsu, Chih-Chung Chang, Chih-Jen Lin, et al. A practical guide to support vector classification, 2003. [7] Jeffrey Huang, Xuhui Shao, and Harry Wechsler. Face pose discrimination using support vector machines (svm). In Pattern Recognition, 1998. Proceedings. Fourteenth International Conference on, volume 1, pages 154 156. IEEE, 1998. [8] Ignas Kukenys and Bran McCane. Support vector machines for human face detection. In Proceedings of the New Zealand Computer Science Research Student Conference, 2008. [9] Wenyi Zhao, Rama Chellappa, P Jonathon Phillips, and Azriel Rosenfeld. Face recognition: A literature survey. Acm Computing Surveys (CSUR), 35(4):399 458, 2003. [10] Wenyi Zhao, Arvindh Krishnaswamy, Rama Chellappa, Daniel L Swets, and John Weng. Discriminant analysis of principal components for face recognition. In Face Recognition, pages 73 85. Springer, 1998.