Please help how to divide big feature vector data into training and testing set for face verification.

I am working on age invariant face verification.
I have 665 feature vector(dimension 665 x 10548) for intra personal pairs with class 1 in one variable.
Similarly 6000 feature vector (dimension is 6000 x 10548) for extra personal pairs with Class -1 in another variable.
Now i want to divide these feature vectors into tarining and testing dataset.(3 cross validation using SVM)
Please tell me any matlab code which do this job automaticaly.

 Accepted Answer

Brett from The Mathworks has 2 face recognition apps in his File Exchange ht<tp://www.mathworks.com/matlabcentral/fileexchange/index?term=authorid%3A911

11 Comments

From this link which .m file will solve my problem and how can i use that??? Please help.
It's just an alternate way of doing face recognition that is presumably working. You might want to use it. If not, then just use rand() to randomly divide your data set into a training set and a testing set.
Please provide proper steps it will be really helpful.
Did you try something like this?
% Concatenate the two feature vector arrays
allfv = [fv1;fv2];
[rows, columns] = size(allfv);
% Determine rows to use as the "training" rows
indexes = randi([0 1], rows, 1);
% Get feature vectors arrays for training and testing.
fvTraining = allfv(indexes, :);
fvTesting = allfv(~indexes, :);
Subscript indices must either be real positive integers or logicals.
Error in traintest (line 23)
fvTraining = allfv(indexes, :);
My database have 82 persons . Each person have randomly 4 to 5 images.
I made all possible pairs of images as intra pairs with class 1(665 pair with same person) and extra pairs with class -1 (6000 pair with different persons ). now after calculating features.
I have two feature vector matrix (665 x 10548) and (6000 x 10548) with labels. Now I want train and test data into 70:30 ratio with 3 cross validation. After that I will use SVM.
Try casting indexes to logical. Right now they're double and that's the problem.
Thanx after converting into logical its working but how it is dividing into training and testing?? Is it the correct way of doing????
It took all your data and randomly assigned them to either a training set or a testing set. As far as "how" - it was by the code, especially this line:
indexes = randi([0 1], rows, 1);
Hey... I have 100 subject database out of which 50 are male and 50 are female. Each subject has 6 images. I just took 1 image per subject i.e 100 images. I just extracted 100 feature vectors and able to cross validate the data. But, I want to utilise all the images of a subject.
So, if I take 6 images of a subject. I would get 600 images and I can cross validate. But, it would not give a correct result as it would divide images from the same subject into testing and training at a time.
So, what I was thinking is that 6 feature vectors which i obtain from a subject should go to either testing or training data. But, I am unable to implement it. How to fix it ? Need your help.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!