资源简介

BP神经网络用于人脸识别,含源文件,识别效果理想

资源截图

代码片段和文件信息

function LibSVM_Classify
%% 训练数据和测试数据的准备
mid = 1/2*nSample;

train_data_N = db(New_Final_Level_Mean_Energy_N(1:mid:));
train_data_O = db(New_Final_Level_Mean_Energy_O(1:mid:));
train_data_I = db(New_Final_Level_Mean_Energy_I(1:mid:));
train_data_B = db(New_Final_Level_Mean_Energy_B(1:mid:));

test_data_N = db(New_Final_Level_Mean_Energy_N(mid+1:end:));
test_data_O = db(New_Final_Level_Mean_Energy_O(mid+1:end:));
test_data_I = db(New_Final_Level_Mean_Energy_I(mid+1:end:));
test_data_B = db(New_Final_Level_Mean_Energy_B(mid+1:end:));

train_data = [train_data_N;train_data_O;train_data_I;train_data_B];
test_data = [test_data_N;test_data_O;test_data_I;test_data_B];

%% 训练数据和测试数据标签
train_label=[ones(tn11);zeros(tn11)];
test_label=[ones(tn01);zeros(tn01)];

%% LibSVM分类
%% GA参数优化cg——gaSVMcgForClass
% maxgen:最大的进化代数默认为200一般取值范围为[100500]
% sizepop:种群最大数量默认为20一般取值范围为[20100]
% cbound = [cmincmax]参数c的变化范围默认为(0100]
% gbound = [gmingmax]参数g的变化范围默认为[01000]
% v:SVM Cross Validation参数默认为5
ga_option.maxgen = 300;
ga_option.sizepop = 60;
ga_option.cbound = [0100];
ga_option.gbound = [01000];
ga_option.v = 5;
ga_option.ggap = 0.9;
[bestaccbestcbestg] = gaSVMcgForClass(train_labeltrain_dataga_option);

%% 网格参数优化cg——SVMcgForClass
%%function [bestaccbestcbestg] = SVMcgForClass(train_labeltraincmincmaxgmingmaxvcstepgstepaccstep)
%[train_scaletest_scaleps] = scaleForSVM(train_datatest_data01);
%[bestaccbestcbestg]=SVMcgForClass(train_labeltrain_data0.13201005114.5);
%% 
fprintf(‘(best c=%gg=%grate=%g)\n‘bestcbestgbestacc);
% cmd = [‘-c‘num2str(bestc)‘-g‘num2mstr(bestg)];
% model = svmtrain(train_label train_data cmd);
% [predict_label accuracy dec_values] = svmpredict(test_label test_data model);

%% SVM可视化
% w = model.SVs‘ * model.sv_coef;
% b = -model.rho;
% [mmmn] = size(model.SVs);

% figure;
% hold on;
% [mn] = size(train_data);
% for run = 1:m
%     if train_label(run) == 1
%         h1 = plot( train_data(run1)train_data(run2)‘r+‘ );
%     else
%         h2 = plot( train_data(run1)train_data(run2)‘g*‘ );
%     end
%     for i = 1:mm
%         if model.SVs(i1)==train_data(run1) && model.SVs(i2)==train_data(run2)
%             h3 = plot( train_data(run1)train_data(run2)‘o‘ );
%         end
%     end
% end
% legend([h1h2h3]‘1‘‘0‘‘Support Vectors‘);
% hold off;

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

     文件     177478  2008-06-12 20:11  006-Face_Angle_BP\program\Images\10_1.bmp

     文件     177478  2008-06-12 18:14  006-Face_Angle_BP\program\Images\10_2.bmp

     文件     177478  2008-06-12 17:20  006-Face_Angle_BP\program\Images\10_3.bmp

     文件     177478  2008-06-12 18:17  006-Face_Angle_BP\program\Images\10_4.bmp

     文件     177478  2008-06-12 19:35  006-Face_Angle_BP\program\Images\10_5.bmp

     文件     177478  2008-06-12 20:11  006-Face_Angle_BP\program\Images\1_1.bmp

     文件     177478  2008-06-12 18:14  006-Face_Angle_BP\program\Images\1_2.bmp

     文件     177478  2008-06-12 17:20  006-Face_Angle_BP\program\Images\1_3.bmp

     文件     177478  2008-06-12 18:18  006-Face_Angle_BP\program\Images\1_4.bmp

     文件     177478  2008-06-12 19:35  006-Face_Angle_BP\program\Images\1_5.bmp

     文件     177478  2008-06-12 20:11  006-Face_Angle_BP\program\Images\2_1.bmp

     文件     177478  2008-06-12 18:14  006-Face_Angle_BP\program\Images\2_2.bmp

     文件     177478  2008-06-12 17:20  006-Face_Angle_BP\program\Images\2_3.bmp

     文件     177478  2008-06-12 18:18  006-Face_Angle_BP\program\Images\2_4.bmp

     文件     177478  2008-06-12 19:35  006-Face_Angle_BP\program\Images\2_5.bmp

     文件     177478  2008-06-12 20:12  006-Face_Angle_BP\program\Images\3_1.bmp

     文件     177478  2008-06-12 18:15  006-Face_Angle_BP\program\Images\3_2.bmp

     文件     177478  2008-06-12 17:20  006-Face_Angle_BP\program\Images\3_3.bmp

     文件     177478  2008-06-12 18:18  006-Face_Angle_BP\program\Images\3_4.bmp

     文件     177478  2008-06-12 19:35  006-Face_Angle_BP\program\Images\3_5.bmp

     文件     177478  2008-06-12 20:12  006-Face_Angle_BP\program\Images\4_1.bmp

     文件     177478  2008-06-12 18:15  006-Face_Angle_BP\program\Images\4_2.bmp

     文件     177478  2008-06-12 17:20  006-Face_Angle_BP\program\Images\4_3.bmp

     文件     177478  2008-06-12 18:19  006-Face_Angle_BP\program\Images\4_4.bmp

     文件     177478  2008-06-12 19:36  006-Face_Angle_BP\program\Images\4_5.bmp

     文件     177478  2008-06-12 20:13  006-Face_Angle_BP\program\Images\5_1.bmp

     文件     177478  2008-06-12 18:15  006-Face_Angle_BP\program\Images\5_2.bmp

     文件     177478  2008-06-12 17:21  006-Face_Angle_BP\program\Images\5_3.bmp

     文件     177478  2008-06-12 18:19  006-Face_Angle_BP\program\Images\5_4.bmp

     文件     177478  2008-06-12 19:36  006-Face_Angle_BP\program\Images\5_5.bmp

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

评论

共有 条评论