资源描述:
《lda人脸识别地matlab程序》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、实用文案LDA人脸识别的matlab程序以下是LDA的m文件函数:你稍稍改改就能用了!function[eigvector,eigvalue,elapse]=LDA(gnd,options,data)%LDA:LinearDiscriminantAnalysis%%[eigvector,eigvalue]=LDA(gnd,options,data)%%Input:%data-Datamatrix.Eachrowvectoroffeaisadatapoint.%gnd-Colunmvectorofthelabelinformat
2、ionforeach%datapoint.%options-StructvalueinMatlab.Thefieldsinoptions%thatcanbeset:%%Regu-1:regularizedsolution,%a*=argmax(a'X'WXa)/(a'X'Xa+ReguAlpha*I)%0:solvethesinularityproblembySVD%Default:0%%ReguAlpha-Theregularizationparameter.Valid%whenRegu==1.Defaultvalueis0
3、.1.%%ReguType-'Ridge':Tikhonovregularization%'Custom':Userprovided%regularizationmatrix%Default:'Ridge'%regularizerR-(nFeaxnFea)regularization%matrixwhichshouldbeprovided%ifReguTypeis'Custom'.nFeais标准文档实用文案%thefeaturenumberofdata%matrix%Fisherface-1:Fisherfaceapproa
4、ch%PCARatio=nSmp-nClass%Default:0%%PCARatio-Thepercentageofprincipal%componentkeptinthePCA%step.Thepercentageis%calculatedbasedonthe%eigenvalue.Defaultis1%(100%,allthenon-zero%eigenvalueswillbekept.%IfPCARatio>1,thePCAstep%willkeepexactlyPCARatioprinciple%components
5、(doesnotexceedthe%exactnumberofnon-zerocomponents).%%%Output:%eigvector-Eachcolumnisanembeddingfunction,foranew%datapoint(rowvector)x,y=x*eigvector%willbetheembeddingresultofx.%eigvalue-ThesortedeigvalueofLDAeigen-problem.%elapse-Timespentondifferentsteps%%Examples:
6、%%fea=rand(50,70);%gnd=[ones(10,1);ones(15,1)*2;ones(10,1)*3;ones(15,1)*4];%options=[];%options.Fisherface=1;%[eigvector,eigvalue]=LDA(gnd,options,fea);%Y=fea*eigvector;标准文档实用文案%%%SeealsoLPP,constructW,LGE%%%%Reference:%%P.N.Belhumeur,J.P.Hespanha,andD.J.Kriegman,揈i
7、genfaces%vs.fisherfaces:recognitionusingclassspecificlinear%projection,�IEEETransactionsonPatternAnalysisandMachine%Intelligence,vol.19,no.7,pp.711-720,July1997.%%DengCai,XiaofeiHe,YuxiaoHu,JiaweiHan,andThomasHuang,%"LearningaSpatiallySmoothSubspaceforFaceRecognitio
8、n",CVPR'2007%%DengCai,XiaofeiHe,JiaweiHan,"SRDA:AnEfficientAlgorithmfor%LargeScaleDiscriminantAnalysis",IEEETransactionsonKnowledgeand%Dat