• 大小: 44.29MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-07-24
  • 语言: Matlab
  • 标签: MATLAB  微表情  pca  

资源简介

通过gabor小波提取表情特征,pca进行降维,最后通elm进行分类,识别结果由MATLAB的GUI输出

资源截图

代码片段和文件信息

function [TestingTime label_index_expected output] = elm_predict(test_data dt)

% Usage: elm_predict(TestingData_File)
% OR:    [TestingTime TestingAccuracy] = elm_predict(TestingData_File)
%
% Input:
% TestingData_File      - Filename of testing data set
%
% Output:
% TestingTime           - Time (seconds) spent on predicting ALL testing data
% TestingAccuracy       - Testing accuracy:
%                           RMSE for regression or correct classification rate for classification
%
% MULTI-CLASSE CLASSIFICATION: NUMBER OF OUTPUT NEURONS WILL BE AUTOMATICALLY SET EQUAL TO NUMBER OF CLASSES
% FOR EXAMPLE if there are 7 classes in all there will have 7 output
% neurons; neuron 5 has the highest output means input belongs to 5-th class
%
% Sample1 regression: [TestingTime TestingAccuracy] = elm_predict(‘sinc_test‘)
% Sample2 classification: elm_predict(‘diabetes_test‘)
%
%%%%    Authors:    MR QIN-YU ZHU AND DR GUANG-BIN HUANG
%%%%    NANYANG TECHNOLOGICAL UNIVERSITY SINGAPORE
%%%%    EMAIL:      EGBHUANG@NTU.EDU.SG; GBHUANG@IEEE.ORG
%%%%    WEBSITE:    http://www.ntu.edu.sg/eee/icis/cv/egbhuang.htm
%%%%    DATE:       APRIL 2004

%%%%%%%%%%% Macro definition
REGRESSION=0;
CLASSIFIER=1;
label_index_expected = 0;
%%%%%%%%%%% Load testing dataset
TV.T=test_data(:1)‘;
TV.P=test_data(:2:size(test_data2))‘;
clear test_data;                                    %   Release raw testing data array

NumberofTestingData=size(TV.P2);

load elm_model.mat;

if Elm_Type~=REGRESSION
    
    %%%%%%%%%% Processing the targets of testing
    temp_TV_T=zeros(NumberofOutputNeurons NumberofTestingData);
    for i = 1:NumberofTestingData
        for j = 1:size(label2)
            if label(1j) == TV.T(1i)
                break;
            end
        end
        temp_TV_T(ji)=1;
    end
    TV.T=temp_TV_T*2-1;
    
end                                                 %   end if of Elm_Type

%%%%%%%%%%% Calculate the output of testing input
start_time_test=cputime;
tempH_test=InputWeight*TV.P;
clear TV.P;             %   Release input of testing data
ind=ones(1NumberofTestingData);
BiasMatrix=BiasofHiddenNeurons(:ind);              %   Extend the bias matrix BiasofHiddenNeurons to match the demention of H
tempH_test=tempH_test + BiasMatrix;
switch lower(ActivationFunction)
    case {‘sig‘‘sigmoid‘}
        %%%%%%%% Sigmoid
        H_test = 1 ./ (1 + exp(-tempH_test));
    case {‘sin‘‘sine‘}
        %%%%%%%% Sine
        H_test = sin(tempH_test);
    case {‘hardlim‘}
        %%%%%%%% Hard Limit
        H_test = hardlim(tempH_test);
        %%%%%%%% More activation functions can be added here
end
TY=(H_test‘ * OutputWeight)‘;                       %   TY: the actual output of the testing data
end_time_test=cputime;
TestingTime=end_time_test-start_time_test;           %   Calculate CPU time (seconds) spent by ELM predicting the whole testing data

if Elm_Type == REGRESSION
   

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-03-05 20:01  微表情识别代码\
     目录           0  2018-03-05 20:01  微表情识别代码\Database\
     文件       65734  2001-02-13 13:40  微表情识别代码\Database\KA.AN1.39.tiff
     文件       67368  2004-07-20 18:55  微表情识别代码\Database\KA.AN2.40.tiff
     文件       65734  2001-02-13 13:40  微表情识别代码\Database\KA.AN3.41.tiff
     文件       65734  2001-02-13 13:40  微表情识别代码\Database\KA.DI1.42.tiff
     文件       65734  2001-02-13 13:40  微表情识别代码\Database\KA.DI2.43.tiff
     文件       65734  2001-02-13 13:40  微表情识别代码\Database\KA.DI3.44.tiff
     文件       65734  2001-02-13 13:40  微表情识别代码\Database\KA.FE1.45.tiff
     文件       65734  2001-02-13 13:40  微表情识别代码\Database\KA.FE2.46.tiff
     文件       65734  2001-02-13 13:40  微表情识别代码\Database\KA.FE3.47.tiff
     文件       65734  2001-02-13 13:40  微表情识别代码\Database\KA.FE4.48.tiff
     文件       65734  2001-02-13 13:41  微表情识别代码\Database\KA.HA1.29.tiff
     文件       65734  2001-02-13 13:41  微表情识别代码\Database\KA.HA2.30.tiff
     文件       65734  2001-02-13 13:41  微表情识别代码\Database\KA.HA3.31.tiff
     文件       65734  2001-02-13 13:41  微表情识别代码\Database\KA.HA4.32.tiff
     文件       65734  2001-02-13 13:41  微表情识别代码\Database\KA.NE1.26.tiff
     文件       65734  2001-02-13 13:41  微表情识别代码\Database\KA.NE2.27.tiff
     文件       65734  2001-02-13 13:41  微表情识别代码\Database\KA.NE3.28.tiff
     文件       65734  2001-02-13 13:41  微表情识别代码\Database\KA.SA1.33.tiff
     文件       65734  2001-02-13 13:41  微表情识别代码\Database\KA.SA2.34.tiff
     文件       65734  2001-02-13 13:41  微表情识别代码\Database\KA.SA3.35.tiff
     文件       65734  2001-02-13 13:41  微表情识别代码\Database\KA.SU1.36.tiff
     文件       65734  2001-02-13 13:42  微表情识别代码\Database\KA.SU2.37.tiff
     文件       65734  2001-02-13 13:42  微表情识别代码\Database\KA.SU3.38.tiff
     文件       65734  2001-02-13 13:42  微表情识别代码\Database\KL.AN1.167.tiff
     文件       65734  2001-02-13 13:43  微表情识别代码\Database\KL.AN2.168.tiff
     文件       65734  2001-02-13 13:43  微表情识别代码\Database\KL.AN3.169.tiff
     文件       65734  2001-02-13 13:43  微表情识别代码\Database\KL.DI1.170.tiff
     文件       65734  2001-02-13 13:43  微表情识别代码\Database\KL.DI2.171.tiff
     文件       65734  2001-02-13 13:43  微表情识别代码\Database\KL.DI3.172.tiff
............此处省略661个文件信息

评论

共有 条评论