当前位置:首页 > SVD与KFDA相结合人脸识别-matlab-毕业论文
XXXXxx毕业设计(论文)
致谢
时光如梭,大学的四年已经接近尾声,在完成毕业论文之际,谨向许多曾经关心、帮助和支持过我的所有人表达我最诚挚的谢意!
首先感谢我的指导老师XXX老师。X老师学识渊博、思维敏捷、作风严谨,我能够顺利完成毕业论文,离不开X老师的悉心指导,使我深刻感受到导师在对学生的厚爱和希望。感谢一直以来关心我、爱护我的所有同学和朋友们,是他们的理解和帮助使我充满信心和动力。在此献上我最衷心的感激和祝福!
XXX
200x年x月x日
22
XXXXxx毕业设计(论文)
附录1
SVD+KFDA程序 : tic; clear clc
Iv=zeros(120,96,9,50); for i=1:50 for j=1:9
a=imread(strcat('E:\\cas-peal\\s',num2str(i),'\\',num2str(j),'.bmp')); b=double(a); Iv(:,:,j,i)=b; end end
dim1=size(Iv,1);
dim2=size(Iv,2); %图像的维数 tal=size(Iv,3); %每类样本的个数 class=size(Iv,4); %类别数 ell=5; %每类的训练样本数
ellsample=9-ell; %每类的测试样本数 NumTotal=ell*class; %训练样本总数 bb=49;
%装入训练样本
Itr=zeros(dim1,dim2,ell,class); for classnum=1:class for e=1:ell
Itr(:,:,e,classnum)=Iv(:,:,e,classnum); end end
%装入测试样本
It=zeros(dim1,dim2,ellsample,class); for classnum=1:class for e=1:ellsample
It(:,:,e,classnum)=Iv(:,:,e+ell,classnum); end
23
XXXXxx毕业设计(论文)
end
%计算所有训练样本的均值 Imean=zeros(dim1,dim2); for classnum=1:class for i=1:ell
Imean=Imean+Itr(:,:,i,classnum); end end
Imean=Imean/NumTotal; [U S V]=svd(Imean);
%所有训练样本投影到样本均值酉矩阵的基空间中 m=28; n=m;
Sfeature1=zeros(m,n); Sfeature=zeros(ell*class,m*n); for classnum=1:class for e=1:ell
S1=U'*Itr(:,:,e,classnum)*V; for i=1:m for j=1:n
Sfeature1(i,j)=S1(i,j); end end
Sfeature((classnum-1)*ell+e,:)= Sfeature1(1:end); end end
%所有测试样本投影到样本均值酉矩阵的基空间中 Tfeature1=zeros(m,n);
Tfeature=zeros(class*ellsample,m*n); for classnum=1:class for e=1:ellsample
S2=U'*It(:,:,e,classnum)*V; for i=1:m for j=1:n
Tfeature1(i,j)=S2(i,j); end
24
XXXXxx毕业设计(论文)
end
Tfeature((classnum-1)*ellsample+e,:)=Tfeature1(1:end); end end
gnd=[ones(ell,1);ones(ell,1)*2;ones(ell,1)*3;ones(ell,1)*4 ;ones(ell,1)*5;ones(ell,1)*6;ones(ell,1)*7;ones(ell,1)*8;ones(ell,1)*9;ones(ell,1)*10;ones(ell,1)*11;ones(ell,1)*12;ones(ell,1)*13;ones(ell,1)*14;ones(ell,1)*15;ones(ell,1)*16;ones(ell,1)*17;ones(ell,1)*18;ones(ell,1)*19;ones(ell,1)*20;ones(ell,1)*21;ones(ell,1)*22;ones(ell,1)*23;ones(ell,1)*24;ones(ell,1)*25;ones(ell,1)*26;ones(ell,1)*27;ones(ell,1)*28;ones(ell,1)*29;ones(ell,1)*30;ones(ell,1)*31;ones(ell,1)*32;ones(ell,1)*33;ones(ell,1)*34;ones(ell,1)*35;ones(ell,1)*36;ones(ell,1)*37;ones(ell,1)*38;ones(ell,1)*39;ones(ell,1)*40;ones(ell,1)*41;ones(ell,1)*42;ones(ell,1)*43;ones(ell,1)*44;ones(ell,1)*45;ones(ell,1)*46;ones(ell,1)*47;ones(ell,1)*48;ones(ell,1)*49;ones(ell,1)*50]; options.KernelType='Gaussian'; options.t=8000;
[eigvector,eigvalue]=KDA(options,gnd,Sfeature); test=constructKernel(Tfeature,Sfeature,options); yy=test*eigvector;
train=constructKernel(Sfeature,Sfeature,options); xx=train*eigvector; accu=0;
train1=zeros(bb,ell,class); for classnum=1:class for e=1:ell
train1(:,e,classnum)=xx((classnum-1)*ell+e,:); end end
test1=zeros(bb,ellsample,class); for classnum=1:class for e=1:ellsample
test1(:,e,classnum)=yy((classnum-1)*ellsample+e,:); end end for i=1:class
for j=1:ellsample for p=1:class for q=1:ell
25
XXXXxx毕业设计(论文)
mdist((p-1)*ell+q)=norm(test1(:,j,i)-train1(:,q,p)); end end
[dist,index2]=sort(mdist); class1=floor((index2(1)-1)/ell)+1; if class1==i accu=accu+1; end end end toc;
accuracy=accu/(class*ellsample) %输出识别率
附录2
实验数据.doc
26
共分享92篇相关文档