基于稀疏表示的人脸识别Matlab程序


最新的基于稀疏表示的人脸识别程序,用Matlab编写,包括了快速算法的实现,是目前识别率和效率较高的最新人脸识别技术的具体算法实现,不可多得!希望能帮助大家!
资源截图
代码片段和文件信息
function [X accuracy avgTime] = fsc_main(Y A D L sc_algo trainLabel testLabel numClass displayProgressFlag)

% ---------------------------------------------------
% Fast Sparse Representation with Prototypes: fsc_main 
% Functionality: 
%       Find the approaximated sparse solution x of the linear system y=Ax
% Dimension: m --- number of measurement
%            Nt--- number of testing samples
%            Nd--- number of training samples
%
%                   Dimension          Description
% input:  Y          m x Nt        --- the testing sample
%         A          m x Nd        --- the training sample
%         D          m x K         --- the learned dictionary
%         trainLabel 1 x Nt        --- the label of training sample
%         L                        --- the number of atoms in OMP
%         sc_algo                  --- the sparse coding algorithm
%                            e.g. l1magic SparseLab fast_sc SL0 YALL1
% output: X          K x Nt       --- the sparse coefficient matrix of Y
%         accuracy                 --- accuracy of the classification task
%         avgTime                  --- average runtime for sparse coding

% Reference: Jia-Bin Huang and Ming-Hsuan Yang “Fast Sparse Representation with Prototypes.“ the 23th IEEE Conference
%            on Computer Vision and Pattern Recognition (CVPR 10‘) San Francisco CA USA June 2010.
% Contact: For any questions email me by jbhuang@ieee.org
% ---------------------------------------------------

[m Nt]= size(Y);
[m Nd]= size(A);
[m K]= size(D);

X = zeros(Nd Nt);

% Compute the new representation of A as W
WA = OMP(D A L);

% Compute the new representation of Y as Wy
WY = OMP(D Y L);

% Compute the sparse representation X

Ainv = pinv(A);
sumTime=0;
correctSample=0;
for i = 1: Nt
    % Inital guess
    xInit = Ainv * Y(:i);
    xp = zeros(Nd1);
    
    % new representation of the test sample y
    w_y = WY(:i);
    
    % keep columns with a least one overlapped support and dicard the rest
    [WA_reduced releventPosition] = reduceMatrix(w_y WA);
    
    % sparse coding: solve a reduced linear system
    tic
    xpReduced = sparse_coding_methods(xInit(releventPosition) WA_reduced w_y sc_algo);
    t = toc;

    sumTime = sumTime+t;

    xp(releventPosition)=xpReduced;
   
    X(: i) = xp;
    
    % Predict label of the test sample
    residuals = zeros(1numClass);
    for iClass = 1: numClass
        xpClass = xp;
        xpClass(trainLabel~= iClass) = 0;
        residuals(iClass) = norm(Y(:i) - A*xpClass);
    end
    [val ind] = min(residuals);
    if(ind==testLabel(i))
        correctSample = correctSample+1;
    end
   
    if(displayProgressFlag)
        avgTime = sumTime/i;
        accuracy = correctSample / i;
        fprintf(‘Accuracy = %f %% (%d out of %d) speed = %f s
‘ accuracy*100 correctSample i avgTime);
    end
end

accu

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       2795  2010-06-01 16:41  FSR codefsc_main.asv

     文件       3054  2010-06-01 19:32  FSR codefsc_main.m

     文件        884  2010-05-27 19:46  FSR codefsr_main.asv

     文件       3499  2010-06-01 15:48  FSR codegetTrainTestData.asv

     文件       2838  2010-06-01 17:14  FSR codegetTrainTestData.m

     文件        528  2010-05-31 22:27  FSR codelabelPrediction.asv

     文件       1573  2010-06-01 18:07  FSR code
eadme.txt

     文件       1393  2010-06-01 18:05  FSR code
educeMatrix.m

     文件       3117  2010-06-01 19:36  FSR code
un_sparsity_based_classification.m

     文件       2421  2010-06-01 17:59  FSR codesc_main.m

     文件       1643  2010-06-01 18:03  FSR codesparse_coding_methods.m

     文件     185727  2005-09-11 15:43  FSR code oolsdictionary learningKSVD_Matlab_ToolBoxarbara.png

     文件     177762  2005-09-11 15:44  FSR code oolsdictionary learningKSVD_Matlab_ToolBoxoat.png

     文件       1907  2009-09-03 10:54  FSR code oolsdictionary learningKSVD_Matlab_ToolBoxdemo1.m

     文件       3561  2006-12-12 09:13  FSR code oolsdictionary learningKSVD_Matlab_ToolBoxdemo2.m

     文件       8504  2006-12-28 13:57  FSR code oolsdictionary learningKSVD_Matlab_ToolBoxdemo3.m

     文件       5426  2007-01-24 07:53  FSR code oolsdictionary learningKSVD_Matlab_ToolBoxdenoiseImageDCT.m

     文件       6046  2006-12-12 09:18  FSR code oolsdictionary learningKSVD_Matlab_ToolBoxdenoiseImageGlobal.m

     文件       9088  2007-01-24 07:53  FSR code oolsdictionary learningKSVD_Matlab_ToolBoxdenoiseImageKSVD.m

     文件       3246  2007-01-25 08:39  FSR code oolsdictionary learningKSVD_Matlab_ToolBoxdisplayDictionaryElementsAsImage.asv

     文件       3224  2007-01-25 08:39  FSR code oolsdictionary learningKSVD_Matlab_ToolBoxdisplayDictionaryElementsAsImage.m

     文件       1896  2006-12-11 14:25  FSR code oolsdictionary learningKSVD_Matlab_ToolBoxgererateSyntheticDictionaryAndData.m

     文件    5749450  2005-09-21 08:35  FSR code oolsdictionary learningKSVD_Matlab_ToolBoxglobalTrainedDictionary.mat

     文件      34985  2005-09-11 15:44  FSR code oolsdictionary learningKSVD_Matlab_ToolBoxhouse.png

     文件      12292  2009-09-03 10:54  FSR code oolsdictionary learningKSVD_Matlab_ToolBoxKSVD.m

     文件      11585  2006-12-28 14:02  FSR code oolsdictionary learningKSVD_Matlab_ToolBoxKSVD_NN.m

     文件     151199  2005-09-11 15:44  FSR code oolsdictionary learningKSVD_Matlab_ToolBoxlena.png

     文件       8053  2006-12-12 08:35  FSR code oolsdictionary learningKSVD_Matlab_ToolBoxMOD.m

     文件        631  2006-12-11 09:56  FSR code oolsdictionary learningKSVD_Matlab_ToolBoxmy_im2col.m

     文件       1105  2006-12-24 16:00  FSR code oolsdictionary learningKSVD_Matlab_ToolBoxNN_BP.m

............此处省略871个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)