【人脸识别】基于matlab ksvd字典学习人脸表情识别【含Matlab源码 460期】
【摘要】
一、简介
二、源代码
%
%
% Main Program of KSVD-NN based facial expression recognition.
%
% Ziyang Zhang
c...
一、简介
二、源代码
%
%
% Main Program of KSVD-NN based facial expression recognition.
%
% Ziyang Zhang
clear
datadim='37x30';
%datadim='50x40';
%datadim='gabor_all';
testmethod='unfamiliar';
% prepare image data
[data,label] = PrepareData(datadim,testmethod,9);
% direct nearest neighbor classification
testresult = nearestNeighbor( data.train , label.train , data.test );
rate = length( find( ( testresult - label.test ) == 0 ) ) / length(label.test);
clear testresult;
fprintf('\n Direct nearest neighbot on pixel values: rec rate: %f \n',rate);
% training process using KSVD
param.L = 12;
param.K = 90;
param.numIteration = 20;
param.errorFlag = 0;
param.preserveDCAtom = 0;
param.InitializationMethod = 'DataElements';
param.displayProgress = 1;
disp('Starting to train the dictionary');
tt=cputime;
[Dictionary,KSVDout] = KSVD(data.train,param);
fprintf('\ntime of K-SVD: %f\n\n' , cputime - tt);
%I=showdict(Dictionary,[37,30],10,8,'lines') ;
%imshow(I);
%KSVDout.CoefMatrix = full( KSVDout.CoefMatrix );
tt=cputime;
% Using OMP to find the sparse coefficients for test samples
coeftest = OMP(Dictionary,data.test,param.L);
%coeftest = full( coeftest );
% nearest neighbor classification
testresult = nearestNeighbor( KSVDout.CoefMatrix , label.train , coeftest );
fprintf('\ntime of testing: %f\n\n' , cputime - tt);
rate = length( find( ( testresult - label.test ) == 0 ) ) / length(label.test);
fprintf('\n The result when image dimension: %s test-method: %s \n' , datadim, testmethod );
fprintf(' L(sparsity of coef) = %d, K(number of atoms) = %d : recognition rate: %f \n\n\n',param.L , param.K , rate);
% direct pixal values
testresult = nearestNeighbor( data.train , label.train , data.test );
rate = length( find( ( testresult - label.test ) == 0 ) ) / length(label.test);
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
四、matlab版本及参考文献
1 matlab版本
2014a
2 参考文献
[1] 蔡利梅.MATLAB图像处理——理论、算法与实例分析[M].清华大学出版社,2020.
[2]杨丹,赵海滨,龙哲.MATLAB图像处理实例详解[M].清华大学出版社,2013.
[3]周品.MATLAB图像处理与图形用户界面设计[M].清华大学出版社,2013.
[4]刘成龙.精通MATLAB图像处理[M].清华大学出版社,2015.
[5]孟逸凡,柳益君.基于PCA-SVM的人脸识别方法研究[J].科技视界. 2021,(07)
[6]张娜,刘坤,韩美林,陈晨.一种基于PCA和LDA融合的人脸识别算法研究[J].电子测量技术. 2020,43(13)
[7]陈艳.基于BP神经网络的人脸识别方法分析[J].信息与电脑(理论版). 2020,32(23)
[8]戴骊融,陈万米,郭盛.基于肤色模型和SURF算法的人脸识别研究[J].工业控制计算机. 2014,27(02)
文章来源: qq912100926.blog.csdn.net,作者:海神之光,版权归原作者所有,如需转载,请联系作者。
原文链接:qq912100926.blog.csdn.net/article/details/114461315
【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)