From: Kalani on 23 Apr 2010 06:07 I'm totally new to Matlab and trying to do facial expression recognition in Matlab. I have my feature points written into a .mat file. I tried to adapt the given Matlab SVM code for my task. My mat file('KANEW') has a variable called 'N' with landmark points of a person's different expressions and a it also contains a variable called 'expressions' where every row of feature points is mapped to a file. The feature points of the test image is called 'new'. For the time being I'm only taking 4 columns for comparison. load KANEW data = [N(:,1), N(:,2),N(:,3), N(:,4)]; [train]=data; test=[new(:,1), new(:,2),new(:,3), new(:,4)]; groups = ismember(expressions,'Happy'); cp = classperf(groups); svmStruct = svmtrain(train,groups); svmtrain(train,groups) classes = svmclassify(svmStruct,test); But I only get a value of 0 when I print the value of classes. And for classperf(cp,classes,test); cp.CorrectRate I get an error message saying ??? Error using ==> classperf at 290 Index vector has invalid values. Any kind of help or ideas to proceed with this is really appreciated. Thanks and Regards, Kalani
From: Mohammad A. Mezher on 24 Apr 2010 13:20 "Kalani " <ksamarawickrema(a)gmail.com> wrote in message <hqrri5$q1l$1(a)fred.mathworks.com>... > I'm totally new to Matlab and trying to do facial expression recognition in Matlab. I have my feature points written into a .mat file. I tried to adapt the given Matlab SVM code for my task. My mat file('KANEW') has a variable called 'N' with landmark points of a person's different expressions and a it also contains a variable called 'expressions' where every row of feature points is mapped to a file. The feature points of the test image is called 'new'. For the time being I'm only taking 4 columns for comparison. > > load KANEW > data = [N(:,1), N(:,2),N(:,3), N(:,4)]; > [train]=data; > test=[new(:,1), new(:,2),new(:,3), new(:,4)]; > groups = ismember(expressions,'Happy'); > cp = classperf(groups); > svmStruct = svmtrain(train,groups); > svmtrain(train,groups) > classes = svmclassify(svmStruct,test); > > But I only get a value of 0 when I print the value of classes. And for > classperf(cp,classes,test); > cp.CorrectRate > > I get an error message saying > > ??? Error using ==> classperf at 290 > Index vector has invalid values. > > Any kind of help or ideas to proceed with this is really appreciated. > Thanks and Regards, > Kalani the training dataset and the testing dataset should be from the same input dataset use [train, test] = crossvalind('holdOut',groups); cp = classperf(groups) so your code could be >load KANEW >[train, test] = crossvalind('holdOut',groups); % type help crossvalind > groups = ismember(expressions,'Happy'); > cp = classperf(groups); > svmStruct = svmtrain(train,groups); > svmtrain(train,groups) > classes = svmclassify(svmStruct,test); it should be ok then
From: Kalani on 26 Apr 2010 02:33 "Mohammad A. Mezher" <mohabedalgani(a)yahoo.com> wrote in message <hqv98f$6vo$1(a)fred.mathworks.com>... > "Kalani " <ksamarawickrema(a)gmail.com> wrote in message <hqrri5$q1l$1(a)fred.mathworks.com>... > > I'm totally new to Matlab and trying to do facial expression recognition in Matlab. I have my feature points written into a .mat file. I tried to adapt the given Matlab SVM code for my task. My mat file('KANEW') has a variable called 'N' with landmark points of a person's different expressions and a it also contains a variable called 'expressions' where every row of feature points is mapped to a file. The feature points of the test image is called 'new'. For the time being I'm only taking 4 columns for comparison. > > > > load KANEW > > data = [N(:,1), N(:,2),N(:,3), N(:,4)]; > > [train]=data; > > test=[new(:,1), new(:,2),new(:,3), new(:,4)]; > > groups = ismember(expressions,'Happy'); > > cp = classperf(groups); > > svmStruct = svmtrain(train,groups); > > svmtrain(train,groups) > > classes = svmclassify(svmStruct,test); > > > > But I only get a value of 0 when I print the value of classes. And for > > classperf(cp,classes,test); > > cp.CorrectRate > > > > I get an error message saying > > > > ??? Error using ==> classperf at 290 > > Index vector has invalid values. > > > > Any kind of help or ideas to proceed with this is really appreciated. > > Thanks and Regards, > > Kalani > > > the training dataset and the testing dataset should be from the same input dataset > use > > [train, test] = crossvalind('holdOut',groups); > cp = classperf(groups) > > so your code could be > > >load KANEW > >[train, test] = crossvalind('holdOut',groups); % type help crossvalind > > groups = ismember(expressions,'Happy'); > > cp = classperf(groups); > > svmStruct = svmtrain(train,groups); > > svmtrain(train,groups) > > classes = svmclassify(svmStruct,test); > > it should be ok then Thanks for the reply. But in my case I'm giving the testing values as a user input instead of randomly categorizing testing and training values from the database. Is it a must that "the training dataset and the testing dataset should be from the same input dataset"? My training dataset is the full matrix containing the data. My testing dataset is one row of data which has the same no of columns as the train data set which will be newly given by the user.
|
Pages: 1 Prev: xPC Real-time interrupt source (RS232) Next: Matlab SVM Problem |