How to proceed after features extraction to classification step?

9 views (last 30 days)
Hi everyone,
I am totally puzzled about how to proceed with the classification step, after feature extraction. Let's start from the beginning.
I designed an emotion recognition system which produces a massive amount of features. The features number varies depend on four parameters. An average number of features are 7000. My observations also depend on the database I use each time. One of them has 132 individuals. So my final features array is feat_vec(132, 7000). At this point in order to save time and optimise my system's accuracy I thought it would be a good idea not to use the whole amount of data as an entry to my classifier but instead to perform dimensional reduction to my feature array. After a couple of weeks of reading, I decided that the Principal Component Analysis was the best option.
I believe that the sequence of the process is: after the features extraction to use cross validation (5 folds in my case), then to perform PCA on the test features and training features respectively and finally to feed my training data and my test data along with my Labels to a classifier.
In order to do what I described above I wrote the following code:
Folds = 5;
PCA_Comp = 50;
Features = Feat_Vec;
Indices = crossvalind('Kfold',Labels,Folds);
for i = 1:Folds
test = (indices == i); train = ~test;
[TEcoeff, TEscore] = pca(Features(test,:));
[TRcoeff, TRscore] = pca(Features(train,:));
% My 1st question is how to calculate the new reduced data array
class = classify(Sample_Data,Training_Data,Labels(train));
end
For my project, I will be using Linear Discriminant Analysis (LDA). The reason I used the above method to classify my data is that I know how to find the accuracy of my system based on the 5-folds CV. I also know that Discriminant Analysis can be performed by this command/code. My 2nd question is how do find the model's accuracy using fitcdiscr(X,Y) instead of use the traditional method classify(Xte,Xtr,L)?
Thank you for your time,
Costa

Answers (1)

Image Analyst
Image Analyst on 24 Nov 2016
To me, 7000 features seems crazy. Perhaps it's just your terminology and you're mixing up features and observations and subjects. Now I don't know what your features are and what the number of features depends on (the 4 parameters). So I'll guess.
Let's say the 4 parameters are what kind of scene the subject is looking at, for example 1=funny, 2=sad, 3=scary, 4=disgusting.
And let's say feature #1 is eyebrow level, #2=mouth height, #3=mouth width, #4=visibility of teeth, #5=eyes open or closed, #6=height of eyes, #7=hand in front of face, etc.
I just can't imagine that you'd have 7000 features. Maybe a few dozen or a hundred, but 7000??? What are they? You're not doing something like calling "salient points" (the number of which does vary on an image-by-image basis) features are you?
I'm also not sure why the number of features varies. I mean, for a given subject image, maybe the hand is not in front of the face, but you'd still have a value for that feature, like 0 or something.
Because you have an array with a fixed number of columns, feat_vec(132, 7000), the number of features is not varying. Each image has 7000 features. You have 132 subjects. Each subject could be, say, 50 observations if you showed the subject 50 different pictures and snapped a picture of their emotions (face) for each photo/video they're viewing.
  1 Comment
Konstantinos Papazachariou
I am sorry I wasn't clear Image Analyst! I use three patches from the human face (mouth, eyes-eyebrows and nasal area) and calculate the Histograms of Oriented Gradients for these three areas. Then, I concatenate the features from all the areas to produce the final feature array. In order to evaluate the HOG descriptor's performance, cell size and orientation bins parameters are changing. Thus, couple of different cases are created.
One of these cases for example is:
Cell Size: 8x8 / Orientation Bins: 9
(Mouth area: 64x96 / Eyes-Eyebrows area: 64x64 / Nasal area: 56x40) Dimensions of face patches are fixed!
For the above example system produces 7164 features for each person. I extracted them from a database of 132 people. That gave me a feature array with dimensions 132x7164.
I know that it is a crazy amount of data, that's why I thought PCA could help me reduce them. I know that PCA will give back n-1 (in my case 132-1) features but I don't know how to calculate them from [coeff scores] = pca(X) function. Also I don't know if there is a way to perform the everything 'k-fold' CV, PCA and Classification through the fitcdiscr(X,Y) function.
To be honest the only way I performed everything was from the Classification Learner App but I want to write my own code and run it for all the different cases (parameters) I have.
P.S. The emotions in my system are 6 (Anger, Disgust, Fear, Joy, Sadness, Surprise).

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!