人脸识别 MATLAB代码


内部包含orl人脸数据库;朴素贝叶斯分类数值型数据、取点测比例距、训练数据集特征向量化、(PCA+adaboost PCA+SVM人脸识别(可用,全面))四种人脸识别相关的功能,经过测试均可用,4者代码相互之间没有关系,且第四个“测试成功@(PCA+adaboost PCA+SVM(可用,全面))”可以完整进行人脸识别,下载者根据功能需要选择使用
资源截图
代码片段和文件信息
function [Lhits] = ADABOOST_te(adaboost_modelte_func_handletest_settrue_labels)
%
% ADABOOST TESTING
%
%  [Lhits] = ADABOOST_te(adaboost_modelte_func_handletrain_set
%                         true_labels)
%
%           ‘te_func_handle‘ is a handle to the testing function of a
%           learning (weak) algorithm whose prototype is shown below.
%
%           [Lhitserror_rate] = test_func(modeltest_setsample_weightstrue_labels)
%                    model: the output of train_func
%                    test_set: a KxD dimensional matrix each of whose row is a
%                        testing sample in a D dimensional feature space.
%                    sample_weights:  a Dx1 dimensional vector the i-th entry 
%                        of which denotes the weight of the i-th sample.
%                    true_labels: a Dx1 dimensional vector the i-th entry of which
%                        is the label of the i-th sample.
%                    L: a Dx1-array with the predicted labels of the samples.
%                    hits: number of hits calculated with the comparison of L and
%                        true_labels.
%                    error_rate: number of misses divided by the number of samples.
%
%           It is the corresponding testing 
%           module of the function that is specified in the training phase.
%           ‘test_set‘ is a NxD matrix where N is the number of samples
%           in the test set and D is the dimension of the feature space.
%           ‘true_labels‘ is a Nx1 matrix specifying the class label of
%           each corresponding sample‘s features (each row) in ‘test_set‘.
%           ‘adaboost_model‘ is the model that is generated by the function
%           ‘ADABOOST_tr‘.
%
%           ‘L‘ is the likelihoods that are assigned by the ‘ADABOOST_te‘.
%           ‘hits‘ is the number of correctly predicted labels.
%
%        Specific Properties That Must Be Satisfied by The Function pointed
%        by ‘func_handle‘
%        ------------------------------------------------------------------


hypothesis_n = length(adaboost_model.weights);
sample_n = size(test_set1);
if nargin==4
    class_n = length(unique(true_labels));
    temp_L = zeros(sample_nclass_nhypothesis_n); % likelihoods for each weak classifier

    % for each weak classifier likelihoods of test samples are collected
    for i=1:hypothesis_n
        [temp_L(::i)hitserror_rate] = te_func_handle(adaboost_model.parameters{i}...
 test_setones(sample_n1)true_labels);
        temp_L(::i) = temp_L(::i)*adaboost_model.weights(i);
    end

    L = sum(temp_L3);
    hits = sum(likelihood2class(L)==true_labels);
else
    class_n=2;
    temp_L = zeros(sample_nclass_nhypothesis_n); % likelihoods for each weak classifier

    % for each weak classifier likelihoods of test samples are collected
    for i=1:hypothesis_n
        temp_L(::i) = te_func_handle(adaboost_model.parameters{i}...
 test_setones(sampl

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-12-07 21:41  人脸识别 MATLAB代码
     目录           0  2017-12-05 17:01  人脸识别 MATLAB代码orl_
     目录           0  2017-12-05 17:01  人脸识别 MATLAB代码orl_s1
     目录           0  2017-12-05 17:01  人脸识别 MATLAB代码orl_s10
     文件       10318  2017-12-05 11:08  人脸识别 MATLAB代码orl_s101.pgm
     文件       10318  2017-12-05 11:08  人脸识别 MATLAB代码orl_s1010.pgm
     文件       10318  2017-12-05 11:08  人脸识别 MATLAB代码orl_s102.pgm
     文件       10318  2017-12-05 11:08  人脸识别 MATLAB代码orl_s103.pgm
     文件       10318  2017-12-05 11:08  人脸识别 MATLAB代码orl_s104.pgm
     文件       10318  2017-12-05 11:08  人脸识别 MATLAB代码orl_s105.pgm
     文件       10318  2017-12-05 11:08  人脸识别 MATLAB代码orl_s106.pgm
     文件       10318  2017-12-05 11:08  人脸识别 MATLAB代码orl_s107.pgm
     文件       10318  2017-12-05 11:08  人脸识别 MATLAB代码orl_s108.pgm
     文件       10318  2017-12-05 11:08  人脸识别 MATLAB代码orl_s109.pgm
     目录           0  2017-12-05 17:01  人脸识别 MATLAB代码orl_s11
     文件       10318  2017-12-05 11:08  人脸识别 MATLAB代码orl_s111.pgm
     文件       10318  2017-12-05 11:08  人脸识别 MATLAB代码orl_s1110.pgm
     文件       10318  2017-12-05 11:08  人脸识别 MATLAB代码orl_s112.pgm
     文件       10318  2017-12-05 11:08  人脸识别 MATLAB代码orl_s113.pgm
     文件       10318  2017-12-05 11:08  人脸识别 MATLAB代码orl_s114.pgm
     文件       10318  2017-12-05 11:08  人脸识别 MATLAB代码orl_s115.pgm
     文件       10318  2017-12-05 11:08  人脸识别 MATLAB代码orl_s116.pgm
     文件       10318  2017-12-05 11:08  人脸识别 MATLAB代码orl_s117.pgm
     文件       10318  2017-12-05 11:08  人脸识别 MATLAB代码orl_s118.pgm
     文件       10318  2017-12-05 11:08  人脸识别 MATLAB代码orl_s119.pgm
     目录           0  2017-12-05 17:01  人脸识别 MATLAB代码orl_s12
     文件       10318  2017-12-05 11:08  人脸识别 MATLAB代码orl_s121.pgm
     文件       10318  2017-12-05 11:08  人脸识别 MATLAB代码orl_s1210.pgm
     文件       10318  2017-12-05 11:08  人脸识别 MATLAB代码orl_s122.pgm
     文件       10318  2017-12-05 11:08  人脸识别 MATLAB代码orl_s123.pgm
     文件       10318  2017-12-05 11:08  人脸识别 MATLAB代码orl_s124.pgm
............此处省略1356个文件信息

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

发表评论

评论列表(条)